Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Fattie · Mar 20, 2014 at 07:41 AM · guitextperformance

Text in Unity's GUI -- how is it done?

On iOS or Android,

What technology is used to render text, in GUI ?

Thus, is each letter a sprite, with a quad for each letter? Is it actually a text-mesh? (Ie each letter is a shaped mesh.) Is it done in some totally different way native to each platform?

What's the deal there? Cheers

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by pafla · Mar 20, 2014 at 03:40 PM

Very interesting question indeed. Some quick research yielded this:

When you set the Characters drop-down in the Import Settings to Dynamic, Unity will not pre-generate a texture with all font characters. Instead, it will use the FreeType font rendering engine to create the texture on the fly.
https://docs.unity3d.com/Documentation/Components/class-Font.html

According to that text, they use quads with bitmap font characters from a texture atlas (or generated by FreeType). And that seems to be the same for all platforms.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Mar 20, 2014 at 04:19 PM 0
Share

Fascinating insight ...

so to be clear, in your interpretation,

here when unity says: Ins$$anonymous$$d, it will use the FreeType font rendering engine to create the texture on the fly. .........

do you think, what they are saying is:

they will use FreeType TO $$anonymous$$A$$anonymous$$E PNGS {ie, an alphabet sprite sheet} and then they USE QUADS - ONE QUAD FOR EACH CHARACTER to make a sentence.

and that is exactly what you are seeing in text in unity's GUI?

Is that your interpretation there?

in other words, it is identical, would be identical performance, to using any sprite-sheet-one-quad-per-character system (2dtoolkit, etc)

thanks!!

avatar image pafla · Mar 20, 2014 at 05:19 PM 0
Share

do you think, what they are saying is:

they will use FreeType TO $$anonymous$$A$$anonymous$$E PNGS {ie, an alphabet sprite sheet} and then they USE QUADS - ONE QUAD FOR EACH CHARACTER to make a sentence. Basically, yes. Although I doubt that they are creating compressed PNGs at runtime.

in other words, it is identical, would be identical performance, to using any sprite-sheet-one-quad-per-character system (2dtoolkit, etc)
If you do not take possible optimizations into account, that would be the case. But there are several ways of increasing the performance of this technique, especially when it comes to managing the vertex data of the quads, so one can never be sure without accurate measurements.

If you are interested in the low-level aspects of this, Game Program$$anonymous$$g Gems 8 has an article by Aurelio Reis called "Fast Font Rendering with Instancing" that could be a good starting point for your research (lots of references in there too.)

avatar image Fattie · Mar 21, 2014 at 05:43 AM 0
Share

That seems to be the size of it then, pafla - indeed then, even Unity's own "GUI" system, for text it is just rendering quads.

Someone has actually answered a challenging question (has this ever happened on this site before?! ;-) )

I guess in a sense I was hoping for some sort of access to the native (iOS or Android) text rendering, uh, technologies. But no.

Fascinating stuff ...

(Regarding optimizing that .. right. The G.P.G. books are awesome ain't they?)

Just BTW I notice you've only started using this forum, if you're new to Unity .. if you ever need character-shaped mesh (ie, 3D letters) there is a popular and well-loved package "flying text 3D" on the asset store. Cheers!

avatar image Fattie · Mar 21, 2014 at 05:46 AM 1
Share

also just BTW if you're an experienced dev new to unity, you may have reach the point of "total an utter annoyance at throwing some text on the screen" :) for us the only realistic pipeline is to use 2dtoolkit and glyphdesigner - its the only pipeline we use for every client. notice my long comment here http://answers.unity3d.com/questions/384623/setting-font-size-according-to-screen-dpi.html (the one with images) - hope it helps!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

iOS performance: GUItext? want to use text string, but how to instantiate and edit it runtime? 0 Answers

gui text button dont work 1 Answer

Editing certain words in a single NGUI Text Box 0 Answers

Fix Blurry UI text? 10 Answers

How long is a string? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges