TextMesh Pro 1 : 官网文章翻译、基本使用视频教程

这篇具有很好参考价值的文章主要介绍了TextMesh Pro 1 : 官网文章翻译、基本使用视频教程。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

实际操作参考:Unity3d 教程 | TextmeshPro 动态字体 | Fallback | 后备字体 | UI_哔哩哔哩_bilibili

原文链接:TextMesh Pro: Font Asset Creation - Unity Learn

1. 引言

把Font Assets看成字体容器(font container),这样就能在项目中使用各种花里胡哨的字体,但是只需用一个相关文件,不用反复的修改原字体文件。

如果你想使用定制或者本地字体,Font Assets Creator 会把字体文件打包成 altas(字体图),也就是包含了所有基本字体元素的组织文件(Texture file)。

怎么使用Font Assets Creator:

1. 新建文件夹存放 font 文件 , font 文件你电脑就有(c盘->windows->font)。

2. 在 UNITY IDE 中点击 Window -> TextMeshPro -> Fon Asset Creator , 点击后出现如下窗口。

TextMesh Pro 1 : 官网文章翻译、基本使用视频教程

然后,把 font 文件拖拽到 Source Font File 。点击 Genrate Font Atlas , 生成好后会出现黑底白字的 Font Altas ,选个文件夹保存 Font Altas

想要折腾就先不保存,上面还有很多的东西可以进行调试:

Source Font File:就是放字体源文件的地儿

Sampling Point Size /Font Size: This determines the accuracy of the SDF (Signed Distance Field) sampling in reproducing the font. The default setting of Auto Size will attempt to populate the atlas with all characters from the font. When set to Custom, higher values  result in better reproduction. Generally a point size of 50 to 70 is a good range. Be cautious, however, because too large of a sampling size will prevent some characters from being in the atlas.

(这个参数决定了SDF(Signed Distance Field)在生成字符的采样精确度。默认的设置,即 “Auto Size”  会尝试着将你的字体文件包含的所有字符都填充进生成的字体图文件(Font Altas)中 ,。如果你选择Custom Size选项,这个时候需要你手动设置,值约大,字体图形转换的精度越高,通常区间50 ~70就行了。需要注意的时值太高会导致某些字符不会出现在在字体图文件中)

Padding:This dictates the size of effects (outlines, glow, bevels, etc.) from Font Materials. Generally, it’s good for the padding size to be at a 1:10 ratio to the sampling size. A sampling size of 60, for example, should have a padding size of 6. This, however, is not a hard and fast rule. Breaking this ratio can produce interesting effects that might better suit your aesthetic vision for your projects.  (字符间的间的间距,该参数会影响字体材质的效果,如轮廓、光晕、斜面等。通常,取padding size/sampling point size 为1:10。但是取别的比例会生成一些很有趣的效果。)

Packing Method: The method by which the atlas is populated. Fast is good for quickly previewing fonts, while Optimum is best reserved for the final atlas.(选择Fast则生成很快,选择Optimum 则生成的效果最好)
Atlas Resolution: The size of the atlas Texture. This is determined by the Sampling Point Size and Padding. You should cap Atlas Resolution at 2048x2048 for projects targeting mobile devices.(生成的最终贴图的大小,该参数决定字体图的分辨率。参数由 Sampling Point Size与Padding参数决定。针对移动平台的项目,Atlas分辨率应限制在2048x2048。)

Character Set: Determines the range of characters to use within the font. The default is ASCII.

 选择字符集 ,默认 ASCII ,其他的一些选项说明如下

  • Custom Characters: Adds characters from an input field or another Font Asset

  • Custom Range: Adds characters from a hexadecimal(16进制) range

  • Unicode Range (Hex): Adds characters from a unicode range

  • Characters from File: Adds a set of characters from a file. This can be useful for localization or a scenario in which manually populating an atlas would be impractical.  )

Render Mode: Determines how text will be presented. While displaying text at rasterized bitmaps is still supported, use SDF modes unless you’re rendering a small font on a 1:1 ratio (i.e., 10pt font rendered 10px on the screen). (确定文本的显示方式。虽然仍支持在光栅化位图上显示文本,但除非以1:1的比例渲染小字体,即在屏幕上渲染10px的10pt字体,否则请使用SDF模式。)
Get Kerning Pairs: TextMesh Pro can optionally use the kerning information embedded in the font, if available. (可以选择使用 kerning information  )

3. Once all settings are to your liking, select Generate Font Asset to import your new font.

Once your Font Asset has been created, you can access individual settings within the Inspector.(在你设置完毕后,点击Generate Font Asset 生成你的字体,生成好字体文件后,你可以在面板中设置独立的属性)

2. Dynamic and static Font Assets 动 / 静态字体资源

Sometimes we need to populate a Font Atlas with specific characters. One practical reason is creating a font from a subset of characters. This is particularly useful for languages with massive character sets (over 50,000 for Chinese). Most games use about 1,000 characters at most, and games with full Chinese and Japanese language support are some of the few that approach this range. Dynamic SDFs are an alternative way of populating a font atlas with only the characters we need by typing them into the input field. Font fallbacks will be used for all remaining characters as needed.(有时我们需要用特定地字符填充字体图集。如从字符子集创建字体。这对于具有大量字符集的语言(中文字符集超过50000)特别有用。大多数游戏最多使用1000个字符图形,而且要到1000个字符也是少数完全支持中文和日文的那种游戏。动态SDF只生成会用得到的字符集文件,动态asset会生成一个0Mb的asset资源,然后根据输入实时生成字符集合,优点是优秀的空间使用,但是会带来一定的性能负载。剩下的字符如果你想使用我们还有 Font fallbacks 功能)

If desired, the font atlases generated by these dynamically populated Font Assets can be exported, modified to contain external characters (i.e., remapping ‘A’ to a symbol not found in any font atlas), then reimported into Unity.(如果有需要, 动态生成的字体文件可以导出,然后往里面假如外部字符(也就是说可将一个特殊形状的“A”导入其中),然后重新导入Unity。)

步骤如下:

1. Navigate to your desired font within the project hierarchy. Then right-click Create > TextMeshPro > Font Asset. This will create a Font Asset with an empty atlas.(在你的字体文件图标上,依次点击Create > TextMeshPro > Font Asset ,这样你会在同目录下得到一个空的字体图文件)

TextMesh Pro 1 : 官网文章翻译、基本使用视频教程

2. Click on the newly created Font Asset. In the Inspector, navigate to Generation Settings and make sure Atlas Population Mode is set to Dynamic. (点击这个空内容的字体图文件,然后在对应的设置面板中让 Atlas Population Mode 的设置为 Dynamic)

TextMesh Pro 1 : 官网文章翻译、基本使用视频教程

3. Navigate to the TextMeshPro Object, choose this new Font Asset, and input the desired characters as needed.(然后你就可以到对应的 TextMeshPro 组件中使用生成的字体图啦)

It’s good to pack Font Assets dynamically when you need to populate an atlas at runtime (such as for any input fields). However, this requires the source font to be referenced and included within the project build. Static Font Assets are good for containing characters you know will be used throughout the project (menu items, dialog subtitles/text boxes, etc.). As Static Font Assets include all the characters required for the project, they do not need to reference the original font source file.(当您需要在运行时填充字体图的时候,使用动态打包字体资产是很好的。但是,这需要在项目中引用并包含源字体。静态字体资源适合于事先已知在整个项目中将要使用的字符(菜单项、对话框字幕/文本框等)。由于静态字体资源包括项目所需的所有字符,因此它们不需要引用原始字体源文件。)

In short, use static Font Assets for your “knowns” and dynamic Font Assets for your “unknowns.”

3. TMP设置

The TMP Settings Asset found in the TextMesh Pro > Resources folder is used to assign and manage default fonts, Sprites, and fallbacks. While we can apply local settings to individual fonts, the settings in this asset will affect every TextMeshPro Asset in the Scene .

TextMesh Pro>Resources-> TMP Setting  用于  TextMeshPro插件的默认设置)

TextMesh Pro 1 : 官网文章翻译、基本使用视频教程

4. Font Weights

Font weights describe the various appearances your font can take, i.e., bold, italic.(Font weights 用于设置可采用的各种外观,即粗体、斜体等。)

These variations can either be loaded from a new Font Asset or “faked” via the following settings, some of which are default values (你可以导入新的字体实现效果,也可以方便地直接用Font weights 的设置来实现)

TextMesh Pro 1 : 官网文章翻译、基本使用视频教程

5. Font fallbacks

Occasionally we want to reference characters that our font doesn’t contain. Instead of replacing our primary Font Asset, we can instead rely on a fallback. Fallbacks are additional Font Assets that will be referenced when a character does not exist in our primary font.(有时需要用到字体图中不包含的字符。无需替换条字体图文件(font asset、SDF),而是使用fallback ,fallback 的存在就是为了当你的主字体图文件中不包含某个字符时,使用其他的字体资源文件)

Font fallbacks can be set globally within the TMP Settings Asset or locally per Font Asset.(可以设置一个 global 的 fallback ,也能给每个字体图单独设置 fallback)

6. Multi-Atlas Textures

When dynamically populating a Font Atlas, there may come a point when the amount of characters exceed the size of the atlas. When this happens, characters that don’t fit will automatically be placed onto a new atlas and assigned as a fallback to the previous atlas. This is the underlying principle of Multi-Atlas Textures — the ability to populate new atlases as needed during run time. While their memory footprint is larger, they can be valuable for localization use and provide flexibility for modifying atlases at runtime.(字符过多,会生成俩文件,后面的自动作为前一个的fallback ,Multi-Atlas Textures的基本原理就是这个。这种机制占用内存大,但是灵活。)文章来源地址https://www.toymoban.com/news/detail-417616.html

到了这里,关于TextMesh Pro 1 : 官网文章翻译、基本使用视频教程的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 如何为视频内多角色进行翻译配音?含教程和案例

    多角色翻译配音可以应用于任何需要在音频或视频中区分不同角色的情境中,以提高听众的理解和体验。这些场景都需要专业的配音演员和翻译人员来确保高质量的表现。多角色翻译配音在不同情境下都可以有实用场景,以下是一些常见的应用场景:动画片和卡通、电影和电

    2024年01月25日
    浏览(25)
  • [翻译] 使用FXGL创建一个非常基本的游戏

    首先,让我们为我们的简单游戏定义一些要求: 一个600x600的窗口。 屏幕上的玩家,由蓝色矩形表示。 可以通过按键盘上的W、S、A或D来移动玩家。 UI由一行文本表示。 当玩家移动时,UI文本会更新以显示玩家在其生命周期内移动了多少像素。 在本教程的最后,你可以获得这样

    2024年02月01日
    浏览(25)
  • Spring MVC里的DispatchServlet(结合Spring官网翻译)

    在进入这一节之前我建议各位对 Java Web 有比较熟悉的了解以后再进行,否则阅读起来会比较 困难且难以理解 。诸如 Servlet生命周期、ServletContext 、ApplicationContext 等等。如果不太熟悉Java Web,可以参考以下文章: JavaWeb——Servlet(全网最详细教程包括Servlet源码分析) 以及 S

    2024年02月07日
    浏览(34)
  • Minio多节点多驱动分布式部署官网文档翻译

     原文链接: Deploy MinIO: Multi-Node Multi-Drive — MinIO Object Storage for Linux The procedures on this page cover deploying MinIO in a Multi-Node Multi-Drive (MNMD) or “Distributed” configuration. MNMD deployments provide enterprise-grade performance, availability, and scalability and are the recommended topology for all production workloads. M

    2024年02月06日
    浏览(32)
  • postman下载安装和基础使用教程(官网)

    一、下载 1.百度搜索postman,找到官网,点击进去 2.点击Windows的图标,进入下载页面 3.点击Windows64位下载   4.下载完如图所示,双击或右击进行安装 二、安装、使用  5.点击第一个即可  6.此时浏览器会打开一个网址,注册postman账号即可  7.注册账号登录后,打开postman 8.点击

    2024年02月15日
    浏览(73)
  • 《AI上字幕》基于openAI研发的whisper模型,语音(视频)一键转文本/字幕/带时间轴/支持多语言/自带翻译《桌面版教程》

    OpenAI的chatGPT非常火爆,其实OpenAI旗下的另一个模型实力也十分强大,它就是开源免费的Whisper语音转文本模型,目前为止它是较为顶尖的语音转文本模型 当前github上也有许多出色的开发者根据此模型开发出桌面版语音转文字应用。较为出色的分别是Buzz和WhisperDesktop 支持将多种

    2023年04月19日
    浏览(39)
  • ElasticSearch基本使用--ElasticSearch文章一

    https://www.elastic.co/cn/ 1、在当前软件行业中,搜索是一个软件系统或平台的基本功能, 学习ElasticSearch就可以为相应的软件打造出良好的搜索体验。 2、其次,ElasticSearch具备非常强的大数据分析能力。虽然Hadoop也可以做大数据分析,但是ElasticSearch的分析能力非常高,具备Hadoo

    2024年02月14日
    浏览(29)
  • harmonyOS鸿蒙官网教程-Web组件的使用

    相信大家都遇到过这样的场景,有时候我们点击应用的页面,会跳转到一个类似浏览器加载的页面,加载完成后,才显示这个页面的具体内容,这个加载和显示网页的过程通常都是浏览器的任务。 ArkUI为我们提供了Web组件来加载网页,借助它我们就相当于在自己的应用程序里

    2024年01月21日
    浏览(38)
  • 百度翻译API使用教程(前端+后端)

    首先我们需要登录百度翻译开放平台,获取开发者资格: 访问 百度翻译开放平台 然后进行注册(如果有百度账号的话可以直接登录) 注册成功后点击“产品服务”: 跳转到通用文本API界面: 在页面底部点击“立即使用”即可选择服务进行使用 通用文本API有三种服务可供选

    2024年02月14日
    浏览(34)
  • Colab使用教程(超级详细版)及Colab Pro/Pro+评测

    原文:Colab使用教程(超级详细版)及Colab Pro/Pro+评测 - 知乎 在下半年选修了机器学习的关键课程Machine learning and deep learning,但由于Macbook Pro显卡不支持cuda,因此无法使用GPU来训练网络。教授推荐使用Google Colab作为训练神经网络的平台。在高强度的使用了Colab一段时间后,我

    2024年04月22日
    浏览(23)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包