• 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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
3
Question by TheCheese · Nov 28, 2012 at 09:30 PM · fontrichtextbox

How to define what fonts to use for bold or italic when using "Rich Text" markup with imported fonts

I'm trying to bold a certain word in a textmesh. I've imported a bold version of the font as well as a normal version of the font, but it appears that Unity is not using the bold version - presumably because the bold version is not linked to the normal version in any way that I'm aware of. How can I tell Unity to use the bold version of the font?

Thanks.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Graham-Dunnett · Nov 29, 2012 at 11:15 AM

You don't. The markup applies to the current font. There's nothing like CSS in Unity. (Well, GUI elements can be styled. but that applies to the controls and not the font.)

You can of course fake it. Create your normal TTF. Then add the bold and italic versions of your glyphs to this font. Define some substitution rules. Normal A is ascii 65. Perhaps your bold A is 65+100, and your italic A is 65+200. So, write some code that scans your strings, and add 100 to the characters that are inside bold tags, and 200 to characters inside italic tags. Then remove the tags. Your ability to do this of course depends on your character set being small, and having access to tools to create/modify your fonts. If you have commissioned the creation of your own fonts, then just ask the creator to combine the glyphs into a single font.

Comment
Add comment · Show 2 · 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 TheCheese · Nov 29, 2012 at 03:07 PM 0
Share

I'm referring to this new Unity 4 feature - http://docs.unity3d.com/Documentation/$$anonymous$$anual/StyledText.html so I'm afraid your answer doesn't quite apply. Your solution is a handy one to keep in mind, however.

avatar image travisschau · Oct 28, 2015 at 01:25 PM 1
Share

Any more recent information on this feature? Rich text does not seem very useful if the bold is a faked version of the regular font (in my game it just looks stretched out), rather than the actual bold font.

avatar image
0

Answer by ian_unity431 · Jun 11, 2020 at 03:25 PM

Select the normal font asset in your project view, and change the Character field from ASCII default set to Dynamic. You should then be able to use mark up to bold, underline, etc in you text. You don't need an extra font.

Sources: https://docs.unity3d.com/Manual/class-Font.html https://docs.unity3d.com/Packages/com.unity.ugui@1.0/manual/StyledText.html

Comment
Add comment · 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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

14 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

Related Questions

How to find a font via script? 2 Answers

Is there a way to measure the pixel with/height of a string with a given font? 2 Answers

Is it possible to offset a quad in a rich text box 0 Answers

Access to Custom Font Asset in Editor Scripts, no Custom Font Class? 1 Answer

I can't seem to get the font "T4C Beaulieux" to work ! 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges