Jump to content

Add new font to Client


Recommended Posts

  • Active Member

Version of Files XXX

Hi,

 

I wanna add a new font (.ttf) to my client.

I've tried to use "AddFontResourceEx()"(Binary) and on root "fontname":"xxx"

But it does not work =(
Maybe somebody already have done this and can give me a useful hint.

 

thanks

 

  • Metin2 Dev 1
  • Love 2
Link to comment
Share on other sites

  • 4 weeks later...
  • Former Staff

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.

 

 

Oh, he's asking about ADDING a new font not changing it.

Edited by arves100

Everyday you wake up as a Metin2 developer is a bad day...

METIN1 src when

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.