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

Experimental: UTF-8 multilingual font rendering using FreeType #1980

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

YuanBaian
Copy link

It is already possible to implement drawing, but the width and height retrieval needs to be redesigned. The current version contains an unknown bug.

Note: Since I am not familiar with the source code, any path-related parts need to be modified:

You need to manually modify "engine/wscript[line:153]" to specify the folder where "freetype.lib" is stored.
You need to manually modify "cl_font.c[line:120]" to specify the path of the TTF font file.

It is already possible to implement drawing, but the width and height retrieval needs to be redesigned. The current version contains an unknown bug.

Note: Since I am not familiar with the source code, any path-related parts need to be modified:

You need to manually modify "engine/wscript[line:153]" to specify the folder where "freetype.lib" is stored.
You need to manually modify "cl_font.c[line:120]" to specify the path of the TTF font file.
@nekonomicon
Copy link
Member

nekonomicon commented Jan 25, 2025

For what purpose you need to upload freetype headers?
And for what purpose you need to use freetype under Windows?
Windows has native truetype fonts support and better algorithms than freetype.

@nekonomicon
Copy link
Member

Note: Since I am not familiar with the source code, any path-related parts need to be modified:

You can check how it was made in mainui_cpp.

@YuanBaian
Copy link
Author

Note: Since I am not familiar with the source code, any path-related parts need to be modified:

You can check how it was made in mainui_cpp.

Because I don't have enough experience to implement it in multiple ways, I hope to quickly obtain support for UTF8🥺

@a1batross
Copy link
Member

a1batross commented Jan 27, 2025

Sorry for long reply.

For now, it works as proof of concept, but code cleanup is definitely required. There is no need to include FreeType headers, nor hardcode library paths.

Also some stuff better be ported from mainui_cpp's text renderer, it at least supports outline effect required for console font.

Instead of hardcoding fonts paths you can try to load ones included in extras.pk3. It's Wine's Tahoma font and Fira Sans: https://github.com/FWGS/xash-extras/tree/master/gfx/fonts. Not sure how they support Chinese though.

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.

3 participants