Jump to content

Bold Texts are Reversed


Recommended Posts

  • Honorable Member

Hi ppl.

Today is an another day, another reversed small stuff from the official game.

 

Spoiler

1.0.) Open the Client\EterLib\GrpFontTexture.h file and define a new variable into the CGraphicFontTexture class as protected: (below of the italic variable hah so difficult)


	bool	m_bBold;

1.1.) Still in this file extend the arguments of the Create function in the same class, just like this:


	bool Create(const char* c_szFontName, int fontSize, bool bItalic, bool bBold);

2.0.) Close it save it, then open the source file, GrpFontTexture.cpp and initialize the new variable in the CGraphicFontTexture::Initialize function:


	m_bBold = false;

2.1.)  Replace the beginning of the CGraphicFontTexture::Create function as you can see here(new argument and setting the new value into the new variable):


bool CGraphicFontTexture::Create(const char* c_szFontName, int fontSize, bool bItalic, bool bBold)
{
	Destroy();

	strncpy_s(m_fontName, c_szFontName, sizeof(m_fontName)-1);
	m_fontSize	= fontSize;
	m_bItalic	= bItalic;
	m_bBold		= bBold;

3.) In the CGraphicFontTexture::GetFont function replace the following line:


		logFont.lfWeight			= FW_NORMAL;

with this:


		logFont.lfWeight			= (m_bBold) ? FW_BOLD : FW_NORMAL;

4.) Open the GrpText.cpp file and jump into the CGraphicText::OnLoad function, then define a new local variable below of the italic variable:


	bool bBold = false;

4.1.) After that you have to add the following if-statement below of the italic if-statement:


		if(*p == 'b')
			bBold = true;

4.2.) Then extend the argument list of the call of the Create function like this:


	if (!m_fontTexture.Create(strName, size, bItalic, bBold))

5. Done, build and enjoy.

Usage: If you did not see in the video, it depends on the name of the fonts what you would like to set to the TextLines with python:


TextLine = ui.TextLine()
TextLine.SetDefaultFontName() # Default, you don't need to use this btw
TextLine.SetFontName(localeInfo.UI_BOLD_FONT) # Default bolded style
TextLine.SetFontName(localeInfo.UI_ITALIC_FONT)# Default italic style

locale_game.txt resources:


UI_BOLD_FONT	Tahoma:12b
UI_BOLD_FONT_LARGE	Tahoma:14b
UI_BOLD_FONT_SMALL	Tahoma:9b
UI_DEF_FONT	Tahoma:12
UI_DEF_FONT_LARGE	Tahoma:14
UI_DEF_FONT_SMALL	Tahoma:9
UI_ITALIC_FONT	Tahoma:12i
UI_ITALIC_FONT_LARGE	Tahoma:14i
UI_ITALIC_FONT_SMALL	Tahoma:9i

As you can see, at the end of the name of the fonts there is a letter i or b or nothing, I guess it's clear why. :D

 

Any problem? Feedback?
Just write a comment below.

  • Metin2 Dev 4
  • Love 21
Link to comment
Share on other sites

  • Active Member

Good job, but better thing will be if you can fix fonts globally in whole client. Text is rendered badly. Some letters like m, a etc. have some pixels on the bottom of letter or above etc. Try to use Tahoma font size 14px (Tahoma is fixed at size 12px) or Arial font size 12 px and you will see what happen. Problem is pixelating some letters. I think it's a problem of client source text converting. 

Maybe someting of this could fix the problem but idk.

https://docs.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.interop.uidlglogfont.lfcharset?view=visualstudiosdk-2017

@xP3NG3Rx

  • Metin2 Dev 2
  • Sad 1
  • Confused 1
  • Good 2
  • Love 3

I'll be always helpful! 👊 

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
On ‎10‎/‎25‎/‎2018 at 10:12 PM, xP3NG3Rx said:

Hi ppl.

Today is an another day, another reversed small stuff from the official game.

 

  Hide contents

1.0.) Open the Client\EterLib\GrpFontTexture.h file and define a new variable into the CGraphicFontTexture class as protected: (below of the italic variable hah so difficult)



	bool	m_bBold;

1.1.) Still in this file extend the arguments of the Create function in the same class, just like this:



	bool Create(const char* c_szFontName, int fontSize, bool bItalic, bool bBold);

2.0.) Close it save it, then open the source file, GrpFontTexture.cpp and initialize the new variable in the CGraphicFontTexture::Initialize function:



	m_bBold = false;

2.1.)  Replace the beginning of the CGraphicFontTexture::Create function as you can see here(new argument and setting the new value into the new variable):



bool CGraphicFontTexture::Create(const char* c_szFontName, int fontSize, bool bItalic, bool bBold)
{
	Destroy();

	strncpy_s(m_fontName, c_szFontName, sizeof(m_fontName)-1);
	m_fontSize	= fontSize;
	m_bItalic	= bItalic;
	m_bBold		= bBold;

3.) In the CGraphicFontTexture::GetFont function replace the following line:



		logFont.lfWeight			= FW_NORMAL;

with this:



		logFont.lfWeight			= (m_bBold) ? FW_BOLD : FW_NORMAL;

4.) Open the GrpText.cpp file and jump into the CGraphicText::OnLoad function, then define a new local variable below of the italic variable:



	bool bBold = false;

4.1.) After that you have to add the following if-statement below of the italic if-statement:



		if(*p == 'b')
			bBold = true;

4.2.) Then extend the argument list of the call of the Create function like this:



	if (!m_fontTexture.Create(strName, size, bItalic, bBold))

5. Done, build and enjoy.

Usage: If you did not see in the video, it depends on the name of the fonts what you would like to set to the TextLines with python:



TextLine = ui.TextLine()
TextLine.SetDefaultFontName() # Default, you don't need to use this btw
TextLine.SetFontName(localeInfo.UI_BOLD_FONT) # Default bolded style
TextLine.SetFontName(localeInfo.UI_ITALIC_FONT)# Default italic style

locale_game.txt resources:



UI_BOLD_FONT	Tahoma:12b
UI_BOLD_FONT_LARGE	Tahoma:14b
UI_BOLD_FONT_SMALL	Tahoma:9b
UI_DEF_FONT	Tahoma:12
UI_DEF_FONT_LARGE	Tahoma:14
UI_DEF_FONT_SMALL	Tahoma:9
UI_ITALIC_FONT	Tahoma:12i
UI_ITALIC_FONT_LARGE	Tahoma:14i
UI_ITALIC_FONT_SMALL	Tahoma:9i

As you can see, at the end of the name of the fonts there is a letter i or b or nothing, I guess it's clear why. :D

 

Any problem? Feedback?
Just write a comment below.

U are the best !

Link to comment
Share on other sites

  • 2 years later...
  • Honorable Member

First of all thanks for the topic 🙂

Feedback:

Spoiler

You cannot use bold and italic at the same time with current codes.

Here is tut for underline + strikeout + using types at the same time:

Spoiler

 GrpFontTexture.h:

//Find
	bool	m_bItalic;

///Add
	bool	m_bBold;
	bool	m_bUnderLine;
	bool	m_bStrikeOut;

//Find
	bool Create(const char* c_szFontName, int fontSize, bool bItalic);

///Change
	bool Create(const char* c_szFontName, int fontSize, bool bItalic, bool bBold, bool bUnderLine, bool bStrikeOut);

GrpFontTexture.cpp:

//Find
	m_bItalic = false;

///Add
	m_bBold = false;
	m_bUnderLine = false;
	m_bStrikeOut = false;

//Find
bool CGraphicFontTexture::Create(const char* c_szFontName, int fontSize, bool bItalic)
  
///Change
bool CGraphicFontTexture::Create(const char* c_szFontName, int fontSize, bool bItalic, bool bBold, bool bUnderLine, bool bStrikeOut)
  
//Find
  	m_bItalic	= bItalic;

///Add
	m_bBold		= bBold;
	m_bUnderLine	= bUnderLine;
	m_bStrikeOut	= bStrikeOut;

//Find
		logFont.lfWeight			= FW_NORMAL;

///Change
		logFont.lfWeight			= (m_bBold) ? FW_BOLD : FW_NORMAL;

//Find
		logFont.lfUnderline 			= FALSE;
		logFont.lfStrikeOut 			= FALSE;

///Change
		logFont.lfUnderline			= (BYTE) m_bUnderLine;
		logFont.lfStrikeOut			= (BYTE) m_bStrikeOut;

GrpText.cpp:

//Find in bool CGraphicText::OnLoad(int /*iSize*/, const void* /*c_pvBuf*/)
	bool bItalic = false;

///Add
	bool bBold = false;
	bool bUnderLine = false;
	bool bStrikeOut = false;

//Find
		if(*p == 'i')
			bItalic = true;

///Change
		bItalic		= strchr(p, 'i') != NULL;
		bBold		= strchr(p, 'b') != NULL;
		bUnderLine	= strchr(p, 'u') != NULL;
		bStrikeOut	= strchr(p, 's') != NULL;

//Find
	if (!m_fontTexture.Create(strName, size, bItalic))
		return false;

///Change
	if (!m_fontTexture.Create(strName, size, bItalic, bBold, bUnderLine, bStrikeOut))
		return false;

 

UI_DEF_FONT	Tahoma:12ibus
Tahoma: Font Name
12: Font Size
i: Italic
b: Bold
u: Underline
s: Strike Out

(The order of the mods(after the size) doesn't matter.)

Underline:

4rW18R6.png

Strike Out:

xG3o9iw.png

Edited by Metin2 Dev
Core X - External 2 Internal
  • Good 1
  • Love 2

 

Link to comment
Share on other sites

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.