Player icon indicating copy to clipboard operation
Player copied to clipboard

Improve heuristics check to detect broken RM2000-based fonts

Open florianessl opened this issue 5 months ago • 2 comments

This came up in yesterday's discussion on EasyRPGs chat:

The Mexican fangame "Necklace of Elements" (https://rmarchiv.de/games/3824) uses its own custom font that was based on the broken RM2000.fon file which needs to be interpreted & rendered with a fixed size of 6 pixels.

EasyRPG loading up this custom "TLOZFONT": image

Previously, the Player only checked for the font's name which was replaced in this case, so some other heuristics are needed to identify it.

This PR adds a new check, that loads up some glyph sizes and checks if the characters for uppercase 'I' & ' ' are unusually wide (15 pixels) while other characters ('h', lowercase 'l') have a fixed size of 6 & 4 respectively.

florianessl avatar Aug 02 '25 13:08 florianessl

Question is, do we need the cheap name check at all now? What about fonts that are called like that and have been changed in other ways? IMO the new size check is sufficient as it covers more edge-cases.

carstene1ns avatar Aug 09 '25 14:08 carstene1ns

I checked this now with the name check removed (as suggested by c1) and testing with various RM2000 fonts I found:

Fonts.zip

This heuristic works for the fonts RM2000_8 and RM2003_8.

The other font files in the archive appear to have 15 as the width for h and l (actually they have 15 for all glyphs in the font). So their are different types of broken metrics fonts. xD

Question is if @florianessl wants to tune the heuristic to also detect this so we can get rid of the name check or is this a bad idea as can cause false positives?

Ghabry avatar Oct 12 '25 19:10 Ghabry