- Home /
Font size ios devices
Hi, i've a problem with my fontsize, on unity it looks great, but once i build and test my game on ipad2 the size change (very small). Is there a solution to fix that ? Is it true that dynamic font can't be used for ios ?
ps : I used a dynamic font for my script
Thanks.
If you increase the size in the editor does it increase on the build as well, if so its unlikely a problem with dynamic font and more likely due to a difference in pixel density, in which case you can use http://docs.unity3d.com/Documentation/ScriptReference/Screen-dpi.html to make it consistent on different mobile devices. Check my answer here: http://answers.unity3d.com/questions/678598/how-to-set-up-same-sized-text-on-all-screens.html
Hope that helps!
Thank you for the answer, it helps me and i know now the ratio to determenate my fontsize for different devices i hope. i took Screen.width (on debug.log) and compare it with the Screen.width of the ipad2 and i found that is about /2.5 and i go with it. I don't know if it's the best way but it works :). Thanks again
Answer by VIPINSIRWANI · May 09, 2014 at 10:32 AM
Select Font in assets and in inspector window set character as Dynamic and try this code it will work
public GUIText FinalScore;
Void Start()
{
FinalScore.fontSize = (int)(Screen.width * 0.12f);
}
Answer by grendayzer77 · May 09, 2014 at 11:09 AM
private var score : GameObject;
private var z : int;
//ipad 2 and ipad retina
if (Screen.width == 768)
{
z = 2.5;
}
else if (Screen.width == 1536)
{
z = 5.0;
}
score = new GameObject ("Score");
score.AddComponent (GUIText);
score.guiText.fontSize = 22 * z;
// you can added (color, alignement, font...)
it works for ipad2, i didn't test it on ipad retina. Tell me if it works for retina.
Answer by jonas-echterhoff · May 09, 2014 at 12:45 PM
Dynamic fonts work fine on iOS (support for that was added in Unity 4.0, since then dynamic fonts are supported on all platforms). The reason your fonts are appearing small is probably just that you are running on the high resolution screen of your iPad - as others suggested, just use a larger font size, for larger screen resolutions.
Answer by Owen-Reynolds · May 24, 2020 at 03:06 AM
When using a Canvas, "RenderMode: WorldSpace" works fine. It looks the same on iOS as it does in the editor. "ScreenSpace - Camera" doesn't. It seems to count things in pixel sizes, which means iOS's double pixels make text and buttons appear 1/2-sized, and puts some items in the wrong spot (if the position was counted in pixels). I'm not sure about the 3rd setting "ScreenSpace - Overlay".
Your answer
![](https://koobas.hobune.stream/wayback/20220613144611im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Custom Font on iOS4.3.2 & iOS5.0 ?? 0 Answers
IOS Unity 5 UI, Font/Text not displaying/Disappearing 3 Answers
How to use IOS built-in font like Helvetica 0 Answers
iOS font missing when build is nested in another project only after Unity 5.3 update. 0 Answers
Unity Facebook Plugin terminates app after login (iOS) 1 Answer