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/v2] text.GoTextFace doesn't implement font.FontFace interface #3126

Closed
1 of 11 tasks
brymer-meneses opened this issue Oct 9, 2024 · 3 comments
Closed
1 of 11 tasks

Comments

@brymer-meneses
Copy link

brymer-meneses commented Oct 9, 2024

Operating System

  • Windows
  • macOS
  • Linux
  • FreeBSD
  • OpenBSD
  • Android
  • iOS
  • Nintendo Switch
  • PlayStation 5
  • Xbox
  • Web Browsers

What feature would you like to be added?

The Close method is missing from the current implementation of text.GoTextFace.

Why is this needed?

I tried to use face.BoundString which is the recommended approach to get the bounds of a text to be rendered. But this isn't possible because of the missing implementation.

@hajimehoshi
Copy link
Owner

Yeah, this is expected. text.GoTextFace is not font.Face.

@hajimehoshi hajimehoshi closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
@hajimehoshi
Copy link
Owner

hajimehoshi commented Oct 9, 2024

On second thought, it might be possible to implement font.Face for text.GoTextFace in theory, but we should use Measure for widths and Metrics or AppendGlyphs for heights. IMO, we should use HAscent + HDescent for heights.

@hajimehoshi
Copy link
Owner

I looked at the implementation of BoundsString and this iterates each rune in one string. This could be different from how text/v2 renders texts with GoTextFace considering ligatures and various glyphs. So unfortunately it is not possible to implement font.Face for text.GoTextFace.

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

No branches or pull requests

2 participants