Skip to content

Commit 56797c4

Browse files
committed
docs: 微信系统字体文档及demo
1 parent 251ec30 commit 56797c4

File tree

690 files changed

+162827
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

690 files changed

+162827
-0
lines changed

Demo/WX_Font/Assets/Init.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Collections;
2+
using System.Collections.Generic;
3+
using UnityEngine;
4+
using TMPro;
5+
using System.IO;
6+
using UnityEngine.UI;
7+
using WeChatWASM;
8+
using System.Reflection;
9+
using System;
10+
11+
public class Init : MonoBehaviour
12+
{
13+
// Start is called before the first frame update
14+
public Text text;
15+
public TMP_Text tmpText;
16+
void Start()
17+
{
18+
WeChatWASM.WX.InitSDK((ret) =>
19+
{
20+
// fallbackFont作为旧版本微信或者无法获得系统字体文件时的备选CDN URL
21+
var fallbackFont = "https://www.oooceanworld.com/testgame/testfont/36ee0558-77aa-4918-a524-1e472fcb2a12.ttf";
22+
WeChatWASM.WX.GetWXFont(fallbackFont, (font) =>
23+
{
24+
text.font = font;
25+
tmpText.font = TMP_FontAsset.CreateFontAsset(font);
26+
});
27+
});
28+
29+
}
30+
31+
// Update is called once per frame
32+
void Update()
33+
{
34+
35+
}
36+
}

Demo/WX_Font/Assets/Init.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/WX_Font/Assets/Scenes.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)