Jump to content

Partially Fix Font Display in Metin2


Recommended Posts

Hello everyone,

A lot of people might already know the issue. If you choose Arial as Font for Metin2, texts will be displayed in a weird way and with dots.
There are a few reasons for this to happen and increasing font size fixes it, but no one wants huge texts everywhere and obviously, we wannt a nice font. Not a trial and error. So here's a partial fix for it. If you choose very small font sizes (e. g. font size 9px) in locale_game.txt it'll still look a bit off but it's definitely readable. With these changes, you'll have no problem with font sizes 14px and higher.

Maybe someone wants to share different approaches or ideas. I think with these changes the problem is almost entirely fixed, no one needs size 9 especially with Arial..

First open your Binary source and search for "LOGFONT" (without "" of course). You'll find two matches where it's being used for initialization of new fonts: One in TextBar.cpp(CTextBar::__SetFont) and one in GrpFontTexture(CGraphicFontTexture::GetFont). And these are the two functions where we need to make some changes first.

Under the line where LOGFONT is used, you're gonna add the following code:

	HDC hDC = m_dib.GetDCHandle();
	if (hDC)
	{
		auto px = fontSize * 72 / 96;
		fontSize = -MulDiv(px, GetDeviceCaps(hDC, LOGPIXELSY), 72);
	}

This code segment does two things: First it converst px -> pt, since LOGFONT expects pt. And on second, it calculates the correct displaying size according to the ppi and the cell height. This leads to the variable we need: The point size. Note that there's a minus, which means that we'll automatically choose the nearest possible size according to the specified font size. So everything's good here. Als note that you need add this segment to BOTH places where LOGFONT is being used for initialization. You have to change the name fontSize according to the files you edit. In TextBar.cpp the example above fits, for GrpFontTexture you just need to change fontSize to m_fontSize.

Now change the following parts in both functions:

		logFont.lfOutPrecision		= OUT_TT_ONLY_PRECIS;
		logFont.lfClipPrecision		= CLIP_DEFAULT_PRECIS;
		logFont.lfQuality			= NONANTIALIASED_QUALITY;
		logFont.lfPitchAndFamily = VARIABLE_PITCH;

Note: You can also change logFont.lfWeight from FONT_NORMAL to FONT_MEDIUM or any other font weight if you wanna add up a mit more strength to your fonts. I just left it to FONT_NORMAL, which is fine. Also note that I chose NONANTIALIASED_QUALITY since anti-aliasing didn't make any change (not sure if Arial is even compatible, at least not those small font sized that I tested it with..). You can also change them to something like ClearType to do the job, that's up to you. I wanted to display the fonts just like they are, no mangling with them. But depending on your needs you can tweak a bit here.

 

that's almost it! Last but not least, we have to change the way our adapter hDC does it's job. Especially since the above calculation for point size is only 100% true for MapMode MM_TEXT. And that's what we're gonna establish now. If you are in CGraphicFontTexture::GetFont, you can just scroll a bit higher. You'll see the initialization of hdC (function CGraphicFontTexture::Create). just below SetBkColor(hDC,    0); you can add these two lines:

	SetGraphicsMode(hDC, GM_ADVANCED);
	SetMapMode(hDC, MM_TEXT);

Aaand you're done! That's it! Compile and enjoy!

Best Regards
Vanilla

  • Love 25

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

Hi, thanks for your effort !

 

Maybe I'm mistaking but it seems to only grow the font a bit.

And when you try to decrease the font size to go back to normal, all the dots will appear again.

 

What font and size do you use ?

Here are my:

 

Before: prev_Tahoma12.jpg.8111ccecdba11b498df29d2b068db9f8.jpg

After: Tahoma12.jpg.71abe5e2f58df05914c50680e92bb39d.jpg

 

 

Before: prev_Arial12.jpg.a162993873ab7658825052bcf8a3dce4.jpgprev_Arial14.jpg.f20e158aa6895fa09746a171a7273c2f.jpg(and - maybe)
After: Arial12.jpg.6544d5db412366d82fd94efad3138b9d.jpgArial11.jpg.b062ea51a16eea80eda7df55e9ed5bfd.jpg

 

Can someone correct me and show his result ?

Link to comment
Share on other sites

6 minutes ago, ElRenardo said:

Hi, thanks for your effort !

 

Maybe I'm mistaking but it seems to only grow the font a bit.

And when you try to decrease the font size to go back to normal, all the dots will appear again.

 

What font and size do you use ?

Here are my:

 

Before: prev_Tahoma12.jpg.8111ccecdba11b498df29d2b068db9f8.jpg

After: Tahoma12.jpg.71abe5e2f58df05914c50680e92bb39d.jpg

 

 

Before: prev_Arial12.jpg.a162993873ab7658825052bcf8a3dce4.jpgprev_Arial14.jpg.f20e158aa6895fa09746a171a7273c2f.jpg(and - maybe)
After: Arial12.jpg.6544d5db412366d82fd94efad3138b9d.jpgArial11.jpg.b062ea51a16eea80eda7df55e9ed5bfd.jpg

 

Can someone correct me and show his result ?

It's because the problem lays also in "bool CGraphicFontTexture::UpdateTexture()" and "CGraphicFontTexture::GetCharacterInfomation"
I'm trying to fix it too, but all I was able to do was break font even further than it was before
far2.png
(Verdana: 12 [is fixed at 14] with my pFontTexture draw loop edits)

Also changed the way the client draw chars to use user windows formating:
far.png
No dots +  cleartype but weird font-color-background - still working on this ?
Anyway, thanks @Vanilla for LOGFONT px->pt solution, it helped me a little
 

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

I completely abandoned working on the files for this game. I do not respond to private messages.

.png

Link to comment
Share on other sites

  • Gold

@Vanilla I changed only logFont. things and I got the same result, as you got with more changes that you wrote. Arial is almost the same font as Script and I saw something like this: FF_SCRIPT. I think it have something to do with the Script font, but idk how should I use it. But practically I have the problems with letters like o, v which still contain the dot and it looks so ugly ? I'm still searching solution for this dot problem for these two letters. Only ClearType fixed the problem with dots, but this ClearType is used for Asian fonts and in game it looks so ugly.

  • Love 1

I'll be always helpful! 👊 

Link to comment
Share on other sites

@Sumnix did you try and change font_small to 14? Does it work then?

 

Please send me those 3 functions you edited via pm so I can see how they look on your build. Maybe I missed to mention something I've done on my source since the characters are being displayed correctly there..

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

10 hours ago, Vanilla said:

@Sumnix did you try and change font_small to 14? Does it work then?

 

Please send me those 3 functions you edited via pm so I can see how they look on your build. Maybe I missed to mention something I've done on my source since the characters are being displayed correctly there..

original files, can you make the necessary arrangements?

TextBar.cpp

GrpFontTexture.cpp

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

vor 4 Minuten schrieb _Sielu:

rly guys?XD dev just use brain its easy to fix..

for example look for keys map

(without fix)

beforepng_qweneen.png

(with my fix)

afterpng_qweneew.png

rly easy..

If it's so easy, why don't you mind sharing it with the community instead of telling everyone how good you are?

As I said, on my client it's fixed, but I don't remember every change I've made on it, so that's why I asked for the functions and will review them now. If you have a fix and wanna share it, post it, if not, please do not spam this topic with showing yourself off.

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

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

Gerade eben schrieb Kori:

You sell this? 

You post here "I have a fix, but I don't share" you need new costumers? Or what ist the Pont to post here without helping 

I don't see any reason for his posting either. So let's just keep him talk. Would be sad if anyone buys it and we have a fix that's about to be published. If anyone still buys his "easy fix" for money, then this person might not be the smartest one out there considering the fact that we're gonna fix this.

As I said, on my client it works perfectly fine without any dots. So I only have to find the stuff I did on it and didn't mention.. Then we're good to go.

  • Love 3

We are the tortured.
We're not your friends.
As long as we're not visible.
We are unfixable.

Link to comment
Share on other sites

  • Premium
Acum 3 ore, Vanilla a spus:

I don't see any reason for his posting either. So let's just keep him talk. Would be sad if anyone buys it and we have a fix that's about to be published. If anyone still buys his "easy fix" for money, then this person might not be the smartest one out there considering the fact that we're gonna fix this.

As I said, on my client it works perfectly fine without any dots. So I only have to find the stuff I did on it and didn't mention.. Then we're good to go.

Works pretty normal on english, but try on other langs.

Link to comment
Share on other sites

20 hours ago, Vanilla said:

@Sumnix did you try and change font_small to 14? Does it work then?

 

Please send me those 3 functions you edited via pm so I can see how they look on your build. Maybe I missed to mention something I've done on my source since the characters are being displayed correctly there..

TextBar.cpp

GrpFontTexture.cpp

 

help?

  • Metin2 Dev 1
Link to comment
Share on other sites

  • 2 weeks later...
  • Premium

Im proud somebody finally start working on that annoying metin bug.

I have tried to fixed it some time ago but without any effect.

Unfortunately your fix seems not work for me too.

btw. @_Sielu if you managed to fix can you just give us any hint? I respect that you do it for customer so i dont want ready solution just a little hint :)

Link to comment
Share on other sites

  • 4 months later...

Hi,

I saw this topic up again and so I took a few minutes to think about it.

As you can see on the images posted before, the "dot" seems to appear only on the right edge of a character.

 

I managed to fix arial and tahoma latin alphabet by reducing the vertices right and bottom from 0.5.

You will have to do the same for the Outline rendering.

 

I cannot paste the code here myself as I don't have the original file and I did modify the rendering method before.

Please let me know if it's working in other alphabets too.

Link to comment
Share on other sites

  • Bronze
17 hours ago, ElRenardo said:

Hi,

I saw this topic up again and so I took a few minutes to think about it.

As you can see on the images posted before, the "dot" seems to appear only on the right edge of a character.

 

I managed to fix arial and tahoma latin alphabet by reducing the vertices right and bottom from 0.5.

You will have to do the same for the Outline rendering.

 

I cannot paste the code here myself as I don't have the original file and I did modify the rendering method before.

Please let me know if it's working in other alphabets too.

I tried tons of fixes and no one helps me.. Im tired of finding solutions for this.. Im trying it more than year but nothing works for me :( If someone can help me I will pay for it..

  • Confused 1
Link to comment
Share on other sites

19 hours ago, ElRenardo said:

Hi,

I saw this topic up again and so I took a few minutes to think about it.

As you can see on the images posted before, the "dot" seems to appear only on the right edge of a character.

 

I managed to fix arial and tahoma latin alphabet by reducing the vertices right and bottom from 0.5.

You will have to do the same for the Outline rendering.

 

I cannot paste the code here myself as I don't have the original file and I did modify the rendering method before.

Please let me know if it's working in other alphabets too.

Can u share pls?

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.