Jump to content
Your Metin2 zone for C++, Python, Lua.

How to change fonts in client?


Recommended Posts

  • 1 month later...

Metin2 can support different fonts, you just have to call SetFontName("(Font name):(size)") and it will do the job of loading the font for you.

The way the client loads fonts it's oddly complex, but the fonts are loaded as long the first time that the client requires it and then cache em.

The client looks for (font name).fnt, ".fnt" is an internal extension used for identify what font to load (they do not exist in any EterPack nor they actually should unless you really want to)

After all the class complex structure, we finally know that CGraphicText is the one responsable for texts and CGraphicFontTexture is the one who loads the texture.

CGraphicText::OnLoad is called and it creates our FontTexture, specifically it calls CGraphicFontTexture::Craete

From this function, we understand that GDI+ is being used to load fonts (sigh),

the responsable in font creation is  CGraphicFontTexture::GetFont(WORD codePage).

The simpliest solution I can think of is having your users to install the font you'd like to and call SetFontName (Python).

If you really want to load TTF, you actually have to load somewhere your font somewhere by using AddFontMemResourceEx. This would also help you packing your font in EterPacks.

Once the font is loaded, you would have to store the HANDLE inside "m_fontMap"

Metin2 will take care of freeing the memory for you and load the font once it's cached. GDI can load TTF so that's not an issue.

Link to comment
This topic is now closed to further replies.
Style Version: 0.1

The code was completely created from scratch and optimized.

The basic style on which it was created: Default

Created by: Grzyb.ovh

The style was to be simple to browse topics, devoid of graphics, uniform in color and definitely simple. ×

  • Create New...

Important Information

Do you like cookies? 🍪 We use cookies to provide the highest quality of service. Learn more