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

Text layouting tests #1499

Merged
merged 2 commits into from Dec 15, 2021
Merged

Text layouting tests #1499

merged 2 commits into from Dec 15, 2021

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Dec 6, 2021

I don't think these tests are all that useful since they mostly repeat what Makie does internally. The problem with comparing to FreeTypeAbstraction directly (i.e. letting it render at the correct fontsize or the glyph fontsize) is that it doesn't scale characters in float steps but integer steps. So the difference between a 32px and 64px fontsize isn't a factor of 2:

img32, ext32 = renderface(font, '^', 32)
img64, ext64 = renderface(font, '^', 64)
ext32
# FontExtent{Float64}([-11.0, 11.0], [3.0, 23.0], [27.0, 32.0], [21.0, 9.0])
ext64
# FontExtent{Float64}([-21.0, 23.0], [6.0, 47.0], [54.0, 64.0], [41.0, 17.0])

It also seems to do more than just rounding up sometimes:

renderface(font, '_', 20)[2].scale
#2-element Vec2{Float64} with indices SOneTo(2):
# 12.0
#  2.0

ceil.(Int, FreeTypeAbstraction.get_extent(font, '_').scale * 20)
#2-element Vec2{Int64} with indices SOneTo(2):
# 11
#  2

@SimonDanisch SimonDanisch mentioned this pull request Dec 8, 2021
13 tasks
@SimonDanisch
Copy link
Member

Thank you! I guess we need to overthink the text boundingbox API some more after the next release ^^

@SimonDanisch SimonDanisch merged commit d3152d9 into master Dec 15, 2021
@SimonDanisch SimonDanisch deleted the ff/text_test branch December 15, 2021 14:22
@ghost ghost deleted a comment Jan 3, 2022
@ghost ghost deleted a comment Jan 3, 2022
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

Successfully merging this pull request may close these issues.

None yet

2 participants