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

Request SurfacePainter.textbox function to support system fonts #210

Open
RonTang opened this issue Dec 3, 2019 · 4 comments
Open

Request SurfacePainter.textbox function to support system fonts #210

RonTang opened this issue Dec 3, 2019 · 4 comments
Labels
ptext Issue arises in ptext

Comments

@RonTang
Copy link

RonTang commented Dec 3, 2019

Hi, I found SurfacePainter.textbox(screen.draw.textbox) function in screen.py doesn't support to use sysfontname.
I think modify drawbox function in ptext.py and getfont funtion in loaders.py could add support for sysfont. But it is difficult for me to pull a stable and compatible request to add this feature. Please consider adding that this function supports the use of system fonts. Thanks.

@lordmauve
Copy link
Owner

Please can you give an example of what you tried and what didn't work?

@RonTang
Copy link
Author

RonTang commented Dec 3, 2019

Thank you for your reply.My English is not very good I hope you could understand what I say.
I use this code to set font of textbox:
screen.draw.textbox(text,text_box,color ="green", sysfontname="fangsong")
but pygame zero doesn't use correct font to draw.
At first I thought it was my system font problem ,so I test many other system font name in my system. None of them is correct.
At last I found inner drawbox function in the ptext.py doesn't use sysfontname parameter... And our font loader doesn't load system font too.

@RonTang RonTang changed the title The parameter sysfontname of screen.draw.textbox function is invalid The parameter sysfontname of screen.draw.textbox function is invalid(unused) Dec 4, 2019
@RonTang RonTang changed the title The parameter sysfontname of screen.draw.textbox function is invalid(unused) Request SurfacePainter.textbox function to support system fonts Dec 4, 2019
RonTang added a commit to RonTang/pgzero that referenced this issue Dec 6, 2019
@RonTang
Copy link
Author

RonTang commented Dec 6, 2019

I want to use pygame zero to render Chinese. Adding the Chinese font ttf file in the fonts folder can solve it, but the Chinese font file is relatively large, so it is very good to be able to use system fonts. So I added this feature in my own branch. The changes are relatively small and involve two files.
https://github.com/RonTang/pgzero/commit/b02d6139d107cccc10af03d03fead6fc8f271726
@lordmauve Is this OK? if you confirm it, I could pull request the code.Thanks a lot.

@lordmauve
Copy link
Owner

Sounds good, yes, please.

RonTang added a commit to RonTang/pgzero that referenced this issue Dec 16, 2019
support lordmauve#210 modify two files loaders.py and ptext.py
@lordmauve lordmauve added the ptext Issue arises in ptext label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ptext Issue arises in ptext
Projects
None yet
Development

No branches or pull requests

2 participants