[docs] Updated doc of global font

Signed-off-by: jiajia_deng <2894220@gmail.com>
This commit is contained in:
jiajia_deng 2019-06-18 13:45:22 +08:00
parent 76a813d4ae
commit 5418cab76f
2 changed files with 28 additions and 56 deletions

View File

@ -1,64 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<Global>
<!--所有字体-->
<!--0-->
<Font id="system_12" name="system" size="12" default="true"/>
<!--1-->
<Font id="system_10" name="system" size="10"/>
<!--2-->
<Font id="system_14" name="system" size="14"/>
<!--3-->
<Font id="system_16" name="system" size="16"/>
<!--4-->
<Font id="system_18" name="system" size="18"/>
<!--5-->
<Font id="system_bold_10" name="system" size="10" bold="true"/>
<!--6-->
<Font id="system_bold_12" name="system" size="12" bold="true"/>
<!--7-->
<Font id="system_bold_14" name="system" size="14" bold="true"/>
<!--8-->
<Font id="system_bold_16" name="system" size="16" bold="true"/>
<!--9-->
<Font id="system_bold_18" name="system" size="18" bold="true"/>
<!--10-->
<Font id="arial_10" name="arial" size="10"/>
<!--11-->
<Font id="arial_12" name="arial" size="12"/>
<!--12-->
<Font id="arial_14" name="arial" size="14"/>
<!--13-->
<Font id="arial_16" name="arial" size="16"/>
<!--14-->
<Font id="arial_18" name="arial" size="18"/>
<!--15-->
<Font id="arial_bold_10" name="arial" size="10" bold="true"/>
<!--16-->
<Font id="arial_bold_12" name="arial" size="12" bold="true"/>
<!--17-->
<Font id="arial_bold_14" name="arial" size="14" bold="true"/>
<!--18-->
<Font id="arial_bold_16" name="arial" size="16" bold="true"/>
<!--19-->
<Font id="arial_bold_18" name="arial" size="18" bold="true"/>
<!--20-->
<Font id="system_20" name="system" size="20"/>
<!--21-->
<Font id="system_bold_20" name="system" size="20" bold="true"/>
<!--22-->
<Font id="system_22" name="system" size="22"/>
<!--23-->
<Font id="system_bold_12" name="system" size="12" bold="true"/>
<Font id="system_bold_14" name="system" size="14" bold="true"/>
<Font id="system_bold_16" name="system" size="16" bold="true"/>
<Font id="system_bold_18" name="system" size="18" bold="true"/>
<Font id="system_bold_20" name="system" size="20" bold="true"/>
<Font id="system_bold_22" name="system" size="22" bold="true"/>
<!--24-->
<Font id="arial_12" name="arial" size="12"/>
<Font id="arial_14" name="arial" size="14"/>
<Font id="arial_16" name="arial" size="16"/>
<Font id="arial_18" name="arial" size="18"/>
<Font id="arial_20" name="arial" size="20"/>
<Font id="arial_22" name="arial" size="22"/>
<Font id="arial_bold_12" name="arial" size="12" bold="true"/>
<Font id="arial_bold_14" name="arial" size="14" bold="true"/>
<Font id="arial_bold_16" name="arial" size="16" bold="true"/>
<Font id="arial_bold_18" name="arial" size="18" bold="true"/>
<Font id="arial_bold_20" name="arial" size="20" bold="true"/>
<Font id="arial_bold_22" name="arial" size="22" bold="true"/>
<Font id="system_underline_12" name="system" size="12" underline="true"/>
<!--25-->
<Font id="system_24" name="system" size="24"/>
<!--26-->
<Font id="system_underline_14" name="system" size="14" underline="true"/>
<!--27-->
<Font id="system_underline_16" name="system" size="16" underline="true"/>
<!--28-->
<Font id="system_32" name="system" size="32" />
<Font id="system_underline_18" name="system" size="18" underline="true"/>
<Font id="system_underline_20" name="system" size="20" underline="true"/>
<Font id="system_underline_22" name="system" size="22" underline="true"/>
<!--一些常规固定颜色-->
<TextColor name="white" value="#ffffffff"/>
@ -184,9 +156,7 @@
<Class name="prompt" promptmode="true" promptcolor="light_gray"/>
<Class name="edit" hotimage="file='../public/edit/edit1.png' corner='10,10,10,10'" focusedimage="file='../public/edit/edit2.png' corner='10,10,10,10'"/>
<Class name="input" normalimage="file='../public/edit/edit0.png' corner='10,10,10,10'" hotimage="file='../public/edit/edit0.png' corner='10,10,10,10'" focusedimage="file='../public/edit/edit0.png' corner='10,10,10,10'" disabledimage="file='../public/edit/edit0.png' corner='10,10,10,10' fade='80'"/>
<!--头像蒙版-->
<Class name="icon_headimage_mask_40x40" width="40" height="40" bkimage="../public/headmask/icon_headimage_mask_40x40_normal.png"/>
</Global>

View File

@ -7,24 +7,26 @@ Global 全局样式提供了通用的样式列表,避免在多个不同的 XML
## 字体Font
如果你想添加一个字体,则在 `global.xml` 中添加如下代码,程序启动后会根据字体位置顺序依次给字体进行编号,排在第一位的字体编号为 0第二位的为 1依次递增
如果你想添加一个字体,则在 `global.xml` 中添加如下代码,程序启动后会加载所有字体列表到缓存中,以 ID 作为区分(注意,老版本没有 ID 属性,缓存时是根据字体的顺序依次编号放入内存中,一旦指定了 ID 属性,索引将不再生效!)
```xml
<!-- name 代表字体名称size 代表字体大小bold 代表是否粗体underline 代表是否包含下划线 -->
<Font name="system" size="10" bold="true" underline="true"/>
<Font id="system_12" name="system" size="10" bold="true" underline="true"/>
```
当需要使用时,指定字体的编号即可。比如你希望一个 Button 按钮使用第 2 号字体,可以这样写:
当需要使用时,指定字体的编号即可。比如你希望一个 Button 按钮使用 ID 为 system_12 的字体,可以这样写:
```xml
<Button text="Hello Button" font="2"/>
<Button text="Hello Button" font="system_12"/>
```
### Font 所有可用属性
| 属性名称 | 默认值 | 参数类型 | 用途 |
| :--- | :--- | :--- | :--- |
| name | | STRING | 字体名称 |
| id | | STRING | 字体ID一旦使用 ID 属性,字体索引将不再生效) |
| default | false | STRING | 是否是默认字体,如果未给控件指定字体,则使用该字体 |
| name | | STRING | 字体在系统中的名称 |
| size | 12 | INT | 字体大小 |
| bold | false | BOOL | 是否粗体 |
| underline | false | BOOL | 是否下划线 |