- Home /
Trying to make Fonts Fallbacks to real Bold/Italic font data
I have a problem. See the screenshot...
If i choose using Font Style, it's creating alternative character itself, instead of fallback into other existing font.
How I fix this? I see solution like this but it's only for legacy GUI. I need this, so < b> and < i> can appear correctly in my game.
Answer by WillNode · Dec 13, 2016 at 09:52 AM
I figured out about how Unity getting specific font style. Few experiments told me something about things that work and don't. I'll leave this to everyone who have the same problem. From beginning:
Every fonts have a fallback list. That's the list that labeled as "Reference to other fonts in project"
This fallback list is also used as a way to getting alternative bold/italic styling. Therefore, you should make sure every font family are referenced to each other. The inspector shows this can be solved by giving the same name to all font families (this is default, anyway).
If nothing found, they'll attempt to get it from system. Here's the proof:
You must pay attention for that, because it is mean they are not pick the font from project files (therefore, giving varies result on different platforms).
The importer is might broken. See the list again. Even it's same, but for me, it still doesn't work. Fonts still doesn't reference each other, see below.
You can't solve it by deleting then reimporting it again. Closing the project, delete Libraries Folder, reimpoting all project. It didn't work. The solution is type "enter" on Font Names (aka. modify Font Names box), so the importer will start to look for fallbacks in project (took me hours to figure this).
You must do this on all font, one by one.
Sometime the trick above is still don't work. Why? The importer might broken. Sometimes, it is work but didn't show up on importer, or it doesn't been updated. The only way fix this is attempt to modify font's .meta file
If you open font's .meta file, you'll see this section...
fallbackFontReferences:
- {fileID: 12800000, guid: fe015f6966a3b3f408fcbbcda2cd14b0, type: 3}
- {fileID: 12800000, guid: 59146b2b5ecbcde448ff42c68fe3726f, type: 3}
These GUIDs are reference to font fallbacks, so you can check or add if there GUIDs refer to correct font file. I'm solving my problem by adding bold/italic GUIDs to regular font's .meta file.
If you are not seeing the font fallbacks correctly deter$$anonymous$$ed for an imported font, that sounds like a bug. Please submit a report and be sure to include the problematic fonts.
Yeah, i'm using 5.2.1, not sure if this are addressed in newer version. So i'll try it on latest build and file a repro if this still reproducible.
Ah, that explains it. This was definitely fixed (I think it was in 5.4).
Still not fixed on Unity 5.6.1 and more recent versions, see this bug report to stay tuned.
Answer by pfreese · Dec 12, 2016 at 10:17 PM
If you are importing the bold and italic versions of the font along with the normal version (and they have identical family names), it should work automatically when changing style. Check to see how the imported fonts are set up.
thanks, your answer actually help me up to see how they imported.
Answer by gamebytom · Apr 10, 2019 at 06:15 PM
I had the same problem on Unity 2018 3.7 - one of my fonts would not use the real bold font with bold tags in RTF text boxes. It used automatic bolding instead, even though the font families were the same. This didn't happen with all of my fonts - some of my fonts worked perfectly, but with one font it didn't work.... I solved it by increasing the Dynamic Pixels Per Unit on the Canvas from 1 to 3.