I am porting a game from the iPad to iPhone (using XCode cocos+box). I use a custom font (*.ttf) which is nice when drawn with a big font size, but if I use a small font size, the text gets too blurry.
If I do not scale font size itself but scale the font's parent, the text becomes too sharp-cut and memory consuming. Since I'm porting a game, I need font to be a bit blurry, but not too much so that it is still readable.
There is also another problem with the blurriness: not all text looks nice. I create a "Start game" label and it looks just fine but when I create a "Settings" label just the same way it looks more blurry.
Is it because of the *.ttf file or is it me doing something wrong? If it is the font, how can I fix it?
Text and images look blurry if they are drawn at half pixel boundaries, can you provide us with the source code that is responsible for drawing the text into the screen?
Related
The post is a bit long but I tried to explain everything that is connected to the issue.
This screenshot is of the parent ui texts canvas.
This is a screenshot of the description ui text the text in the game looks very big the fonts are very big and stretched.
This is a screenshot of the scene text Image settings :
And the scene ui text settings :
This is a screenshot of the scene ui text when running the game from the exe build file :
And last the description ui text in game when running the build exe file :
How can I make some ui text that will be display the text the same in all the cases something that will be readable nice not too small and not too big ?
In the scene text the text is smaller because I wanted the text to be a bit under the player mouth. In the description text is a bit bigger but then everything get messed.
I think I want the text to be shown like in the scene ui text in all the places. I think the size is fine. but not sure how to do it.
There's a couple of things here that should get your text working nicely across the board.
Firstly, at your root Canvas object, you'll usually have a Canvas Scaler there. The default of "Constant Pixel Size" is often exactly what you don't want. I normally have it set to "Scale With Screen Size", and then set the resolution to 1920x1080. I do that because 1920x1080 (16:9) is the standard Full HD screen size, so you can bet that most of your screen layout is going to look the same across most displays.
The second suggestion would be to use TextMeshPro. If you haven't already got it installed through your Package Manager, then you can find it there. Here's the docs for that. It's FAR superior to the standard Text element and you'll notice less issues trying to get your text looking correct. It's usually just a matter of adding the TMPro_Text UI component to the same object your Text component was originally on (removing the original Text component of course).
I would also leave all scaling for all of your UI items set to (1, 1, 1) where you can and let and scaling be done by the Canvas Scaler. The text elements can certainly be left at (1, 1, 1) and just change the font size.
Once you get these three things sorted, your text should be the same across all of your pages, and devices.
This due to Scaling Rect Transform Component
to solve this don't scale up or scale down UI Elements {Image ,Text, ... just keep Scale 1,1,1 }
First I recommend You to see This to understand this Component
https://www.youtube.com/watch?v=FeheZqu85WI&t=6s
Now to Solve your problem
Set Scale of Description Image (1,1,1)
Set Scale of Description Text (1,1,1)
Do 1,2 with Scene Image, Scene Text
Change Width , Height of{Description Text, Scene Text} with small values 900*400
For a Unity 2D WEB GL game I'm working on I've imported and used a font which isn't one of Unity's default fonts. I use this font for the text which gets displayed on a canvas. Since my text uses some characters which aren't in the font file, I've set the font character option to dynamic. The result is that the special characters get displayed properly but the text looks quite blurry and not at all sharp.
Now what I want is the text to look sharp, but I've tried pretty much everything I could find with no success. The objects which display the text use a Text Component. I've also tried switching to a TextMeshPro Text Component and generating the font atlas and everything but again to no success.
I've also tried to set the font character type to unicode instead to see what it does (eventhough I know it will not work with my special characters). The result was quite sharper but perhaps too sharp. If I play the game not on full screen mode, some letters are so pixely/crispy they just aren't readable. Thus that wasn't an option either.
I'm at my wits end for this one. Any and all help is greatly appreciated!
Here's an image example of the blurry font:
I had the same issue with a font using textmesh pro.
Disabled the HDR of the camera component and then it was much better.
A simple solution to this problem is to play with Unity CanvasScaler component.
This is usually attached to your UI Canvas.
https://docs.unity3d.com/Manual/script-CanvasScaler.html
You can tweak the values here to get the best result.
You should increase 'Dynamic Pixels per Unit' on Canvas Scaler
I've read that Unity has problems rendering clear text and I've tried out several different fixes: setting a large font size on the imported font and changing the character setting to unicode, making the text size large and then scaling it down, setting filter mode to point when it comes to pixel fonts... All these methods seem to work from the editor (as in, the text appears crisp), but in the game the text is still blurry:
vs.
(The screenshot is using free aspect - the text looks better, but still somewhat blurry, when the game view resolution matches the reference resolution.)
Currently, the imported font (not pixel) is set to a size of 180; rendering to smooth; character to unicode. The text isn't scaled right now and is at a size of 50. The canvas is set to scale with screen size, and the reference resolution is 2560x1440 (a Samsung S7). It should also be noted that at a different resolution, the box around the text (which is an image) also gets blurry, which makes me think it's a problem with the canvas scaling.
What am I missing?
Turns out all I had to do was uncheck Low Resolution Aspect Ratios in the game view... The text is still slightly blurry, but likely that's typical of Unity. To counter that, I just decided to use a pixel font (using the fix explained in this video).
I use scaling down as a workaround.
For me, it was using Unity-Remote. After building the app directly I didn't see the blur anymore.
I had the same problem, the best solution to the blurry text problem in Unity is as follows:
Select the text item from the scene.
Go to Font and see where your font is located in your project folder
Go to your font in your project
Change the font size from 16 to 100-300
change "Character" to "Unicode"
Press Apply
After trying to adjust several settings I am still getting blurry text in my NGUI labels. Does anyone know what the issue could be? I tried increasing the font size.
Below is a screenshot that demonstrates. Why is the NEW HIGH SCORE text not high resolution?
UPDATE:
I turned on MakePixelPerfect but the text is still blurry:
This is either a result of font scaling from a font atlas with mip-mapping set to true or it is a result of MakePixelPerfect not being set.
Turn off mip mapping on your font atlas or make sure your labels and parent hierarchy objects run MakePixelPerfect(). Select your label and press alt+shift+p. This should enforce the pixel perfect setting for you.
According to your screen grabs you are using bitmap font right?
If so,
Select texture used by that font
In Inspector select texture type as GUI
This will remove compression. Also make sure your Max Size isnt smaller than texture
I am developing an app for a magazine and simultaneously I am creating images for those magazines using photo shop.
But, when I zoom these images, the text quality is getting loosed.
I have referred to other iPad magazines like India Today. In that, even though I zoom to maximum extent, text quality is too good.
how is that possible? My each image size is almost 800 KB. Even then, when I zoom, I loose the clarity of image. How to maintain the quality of text even when I zoom?
Is that something to do with photoshop editing or coding?
We use the following table for our iPhone/iPad projects when the OS target is 3.2 or above.
Because you are using raster graphics you are in a losing battle of file size vs. zoom quality. Text is natively vector and scales beautifully as you zoom, so you are much better off rendering text as text rather than generating text as an image in Photoshop. There are many ways to accomplish this, one being to have the image be a background layer and the text be a UILabel above the image.