Jump to content

Issue rendering text


Phodex Games
 Share

Recommended Posts

Hi I have a small problem. I think the pictures should explain it pretty good :)

With font size of 12 see the terrible cut on the top?:

RenderIssue.PNG.4061fccb40bc4574ec78e1991b9091f8.PNG

With font size 20 it is a little bit better but somehow not as sharp as it should be;

RenderIssue2.PNG.e254ca9fc470377c0ecf8246e7a2d0d0.PNG

This is how I would expect it to look like:

HowItShouldBE.thumb.PNG.cbdcc17adefb864a1540b14bd76626c8.PNG

I am rendering the text with the default arial.ttf font, I render the following color Vec4(0, 0, 0, 255) and with blendmode Blend.Alpha. So whats the problem? I remember the text rendered sharper another time, but I dont know what I am doing wrong atm? Any suggestions?

 

 

Link to comment
Share on other sites

Hard to tell exactly if the same issue since no code was provided but it may be an antialiasing issue - if so, not quite sure why Josh has not reverted this back yet. Just set your font's style to Font.Smooth when loading.

https://www.leadwerks.com/learn?page=API-Reference_Object_Asset_Font_Load

  • Upvote 1

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Link to comment
Share on other sites

59 minutes ago, macklebee said:

Hard to tell exactly if the same issue since no code was provided but it may be an antialiasing issue - if so, not quite sure why Josh has not reverted this back yet. Just set your font's style to Font.Smooth when loading.

https://www.leadwerks.com/learn?page=API-Reference_Object_Asset_Font_Load

Okey just did this and it kind of is part of the fix, it also seems to be important, if you render the text to keep the following order:

1. Set context blend mode

2. Set context font

3. Set color

4. Draw text

 

EDIT: Ok still found an issue :( it seems to depend on the font size:

Font size 12:

Issue1.PNG.8429b4387c5c088368971fb58ad21347.PNG

Font size 20:

Issue3.PNG.27885a8797840b5eded5951e4212c510.PNG

Font size 50:

Issue2.PNG.94d4fde608fe0dafc8b01ac4e2a28dc9.PNG

The code where it gets drawn is:

--I use an renderer class, which renderes all my objects in on script, to handle render priority:
--current stands for the current rendering object
context:SetBlendMode(current.blend)
if current.font ~= nil then context:SetFont(current.font) end
context:SetColor(current.color)
context:DrawText(current.text, current.pos.x, current.pos.y)

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...