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

How to underline and strikethrough fonts? #224

Open
haoxurt opened this issue Dec 26, 2023 · 4 comments
Open

How to underline and strikethrough fonts? #224

haoxurt opened this issue Dec 26, 2023 · 4 comments

Comments

@haoxurt
Copy link

haoxurt commented Dec 26, 2023

How to underline and strikethrough fonts? Could you indicate me which function or class I can refer to?

@HinTak
Copy link
Collaborator

HinTak commented Dec 26, 2023

These two seem to be part of SkPaint in skia which was removed 7 years ago mono/SkiaSharp#391 . I checked there only one reference to these in current skia-python code, which is in the FontMetrics class. The Font class has a getMetrics method which gets it, but I don't think it supports setting. I.e. it looks like with current skia-python, you can try getting at the metrics of your current font of choice, then draw those lines at the returned positions... though I'd be happy to be corrected if you can set underlinewidth/strikeoutwidth to non-zero and get it to work that way.

In current upstream skia code, it seems that the skparagraph module has a text declaration class and a setter for this. So I'll open a new issue for binding skparagraph if one doesn't exist yet.

@HinTak
Copy link
Collaborator

HinTak commented Dec 26, 2023

There seems to be a custom typeface builder class which allows one to change the metrics of a supplied typeface.
https://github.com/google/skia/blob/b7ac9da3e5ac34baf5da70b3e37cdbfd898ed54b/include/utils/SkCustomTypeface.h#L34

Skia-python currently doesn't touch that, I think. Though it is designated SK_API, it is also not documented...

@haoxurt
Copy link
Author

haoxurt commented Dec 27, 2023

Thanks. I will close this issue.

@haoxurt haoxurt closed this as completed Dec 27, 2023
@HinTak HinTak reopened this Dec 27, 2023
@HinTak
Copy link
Collaborator

HinTak commented Dec 27, 2023

The custom typeface builder class seems stable (SK_API) so we might add that, besides the bigger skparagraph project.

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

2 participants