Terraria

Terraria

Terraria Official Steam Workshop
Create, discover, and download the best Texture/Language/Music Packs & Worlds in order to enhance your Terraria adventures! Create your own content to share with the world! Click below to learn how!
Learn More
zombie6631 1 22 Feb, 2024 @ 5:58am
帮助讨论创建字体资源包时出现的问题
My problem is a bit complex and I have to use a lot of space to describe the circumstances of the problem.🙏

I want to make a font package for Terraria, and the font I chose is Dinkie Bitmap[atelier-anchor.com]. Dinkie Bitmap is a paid font, the official version provides a trial version[atelier-anchor.com] for download. {The paid version I use supports Alfabeto latino (English, French, spanish etc.), simplified and traditional (Chinese), Hiragana and Katakana (Japanese), Cyrillic script (Russian, Ukrainian, Belarusian etc.) and other fonts}
I tried to use DynamicSpriteFontGenerator[forums.terraria.org] (hereinafter referred to as DFG) to generate the Dinkie Bitmap sprite sequence texture map. The DFG configuration file[gist.github.com] itself does not cover the Traditional Chinese and Kana HTML character encoding (you can be obtained from the configuration file The code between two "<start>" and the code between two "<end>" find the coverage).

After generating one of the textures with a font size of 10, (picture1[i.imgur.com]) there will be an additional ".xnb" file in the tool directory. After TConvert[forums.terraria.org] unpack the ".xnb" font file, hundreds of ".png" textures will appear in the output folder. When I open the texture, I opened the texture and found that the pixels of the Dinkie Bitmap design and the pixels of the texture could not be aligned, causing the font to be blurred (because the DFG configuration file mentioned earlier did not Covering Traditional Chinese characters, so the Traditional Chinese characters use the system default 11×12px font to create textures, so we focus on the performance of Simplified Chinese characters, Simplified Chinese is in the lower half of the picture1.) You can see that some parts that originally only occupied one pixel in the design occupy two pixels in the texture. Later I tried a font size of 11, which resulted in each design pixel occupying two texture pixels{picture2[i.imgur.com](Simplified Chinese is in the upper part of the picture2)}.

My current question is, what is the structure tree of the ".nxb" font? Can I edit a single ".png" texture and package it into a font myself? DFG is obviously not suitable for packaging pixel fonts.

Or to think about it differently, DFG has opened its source code[github.com]. Is anyone who can understand the principles of this project?

(My some other observations: The width and height of ".png" textures in ".xnb "fonts are always integer powers of 2, and the width and height seem to depend on the font size I set; the texture height and width are not necessarily equal, and there are also 256×512px; The number of characters in each line of the texture is not equal. This is what makes me confused. How does Terraria retrieve characters from the texture? This is why I was eager to know the structure tree of the .xnb font. It may Contains a script on how to retrieve the desired character from the texture)
Last edited by zombie6631; 22 Feb, 2024 @ 6:17am