Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font render: LOVE's anti-alias pixels look somewhat nicer (although it seems to have a sizing bug) #55

Closed
morew4rd opened this issue Feb 8, 2024 · 5 comments

Comments

@morew4rd
Copy link
Collaborator

morew4rd commented Feb 8, 2024

  • Red boxes are 64x64 pixels and 64 pixels apart
  • Font is loaded with 64 pix height

image

lyte2d code:

local font = lyte.load_font("assets/DroidSansMono.ttf", 64)

lyte.set_font(font)

function lyte.tick()
    lyte.cls(0, 0, 0, 0)

    lyte.set_color(1,0,0,1)
    lyte.draw_rect(10, 10, 64, 64)
    lyte.draw_rect(10, 10+128, 64, 64)

    lyte.set_color(1,1,1,1)
    lyte.draw_text("Hello, wow 1", 10, 10)
end

love2d core:

local font = love.graphics.newFont("assets/DroidSansMono.ttf", 64)

love.graphics.setFont(font)

function love.draw()
    love.graphics.setColor(1,0, 0, 1)
    love.graphics.rectangle("fill", 10, 10, 64, 64)
    love.graphics.rectangle("fill", 10, 10+128, 64, 64)

    love.graphics.setColor(1,1,1,1)
    love.graphics.print("Hello, wow " .. love.graphics.getDPIScale( ), 10, 10)

end

Needs investigation for the differences in size.

Also, LOVE2D's anti-alias pixels look somewhat nicer. Why?

@morew4rd
Copy link
Collaborator Author

morew4rd commented Feb 8, 2024

Also see the discussion here: https://github.com/orgs/lyte2d/discussions/16

@morew4rd
Copy link
Collaborator Author

morew4rd commented Feb 8, 2024

With a potential fix/improvement:

image

Top is LOVE (not sure why it's big, but on Linux it seems properly sized)
Middle is current Lyte2D
Bottom is "improved" Lyte2D

@morew4rd
Copy link
Collaborator Author

morew4rd commented Feb 8, 2024

May have found why LOVE renders things large on my Windows machine: https://love2d.org/forums/viewtopic.php?t=81236

(I have a high res monitor so I have to make my display %125 for readability.)

With that workaround, LOVE now renders boxes with the right size, and the window size is also correct, however, LOVE font rendering seems wrong to me. It's too big, and incorrectly positioned:

image

@morew4rd morew4rd changed the title Rendering size comparison between love and lyte LOVE2D's anti-alias pixels look somewhat nicer (although it seems to have a sizing bug) Feb 8, 2024
@morew4rd morew4rd changed the title LOVE2D's anti-alias pixels look somewhat nicer (although it seems to have a sizing bug) Font render: LOVE's anti-alias pixels look somewhat nicer (although it seems to have a sizing bug) Feb 8, 2024
@morew4rd
Copy link
Collaborator Author

morew4rd commented Feb 9, 2024

Another note: LOVE has a PR for using FreeType's SDF rendering (not accepted, still open: love2d/love#1966)

Let's take a look at this as well.

morew4rd added a commit that referenced this issue Feb 9, 2024
@morew4rd
Copy link
Collaborator Author

OK closing this. In the future, we can take a look at SDF.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant