zpaolo11x/Arcadeflow

`Failed to add a new character to the font: the maximum texture size has been reached`

Closed this issue · 23 comments

When I attempt to load the Sega CD romlist in recent versions of Arcadeflow, attractplus crashes with Failed to add a new character to the font: the maximum texture size has been reached, which appears to be related to SFML.

edit Changing default_font in attract.cfg from FreeSans to "Ubuntu Light" resolved this.

This is a known issue caused by the custom font used to render logos, which sometimes has issues which crash the font renderer. I experienced the same in the past, with Sega CD and updated the logo to fix it, are you on the latest Arcadeflow?

Edit: not sure if it was Mega CD or Sega CD, so I'll double check this afternoon...

Yes, this is on 15.6.

I fixed the SEGA CD logo, it should work with no issues now, you can find it in the fix-logo branch for a test... just take the font folder and use that in your installation.

Tested on Ubuntu, no more crashes and the logo is ok without changing the main font.

Sega 32X is still failing in the same manner.

I just tested on my Ubuntu setup and Sega 32X doesn't fail, do you get any error in the console/log file? What's your screen resolution?

Failed to add a new character to the font: the maximum texture size has been reached
terminate called after throwing an instance of 'std::length_error'
  what():  vector::_M_default_append
[1]    55757 IOT instruction (core dumped)  attractplus

3840x2160

Resolution could be one of the issues, I don't have a 4K display to test, I tried altering the texture size to 3840x2160 and I have no issue with the font, but that's not the same I suppose.
Can you check if the issue persist if you set your display to a 1920x1080 resolution? Or if you can't do that, you can change the texture resolution in Arcadeflow options/perfromance & fx/custom resolution...

Reducing resolution to 1920x1080 allows it to load.

Ok, the problem is that I can't replicate it on my Ubuntu machine because I don't have a 4K screen, and I can't replicate it on my mac even at native resolution (2560x1600). I'll see if I can find a 4K display at work, otherwise I can send you a couple of edited fonts file to check.
This is a problem of malformed font + high resolution, where "malformed" is sometimes very difficult to track down. For example in the case of Sega CD I had to redraw the rectangle around the "CD" and move veeeery slightly from its original position, and it fixed the issue.

I have redone the Sega 32X logo and committed the new logo file to the "main" branch, can you try with the font folder from the main branch and check if Sega CD is still working fine, and if Sega 32X is fixed?

Both are working at 3840x2160 now. Thanks!

Some of the logos I use are svgs downloaded from wikimedia or other sources and sometimes they are really badly formed, with very tiny details or overlaps. If you find more issues with logos at 4K please let me know and re-open this issue, I'll check and fix them :)

Attract-Mode Plus v3.0.4 (Linux, SFML 2.6.0 +Xinerama +7z +Curl) 
avcodec 58.134.100 / avformat 58.76.100 / swscale 5.9.100 / avutil 56.70.100 / swresample 3.9.100

Unrecognized "general" setting of "default_font" in file: /home/seamonkey/.attract/attract.cfg.  Valid settings are: display, sound, input_map, general, plugin, saver_config, layout_config, intro_config, menu_config, language, exit_command, exit_message, ui_font_size, screen_saver_timeout, displays_menu_exit, hide_brackets, group_clones, startup_mode, confirm_favourites, confirm_exit, mouse_threshold, joystick_threshold, window_mode, screen_rotation, filter_wrap_mode, track_usage, multiple_monitors, smooth_images, selection_max_step, selection_speed_ms, move_mouse_on_launch, scrape_snaps, scrape_marquees, scrape_flyers, scrape_wheels, scrape_fanart, scrape_videos, scrape_overview, thegamesdb_key, power_saving, video_decoder, menu_prompt, menu_layout, image_cache_mbytes
Unrecognized "general" setting of "font_path" in file: /home/seamonkey/.attract/attract.cfg.  Valid settings are: display, sound, input_map, general, plugin, saver_config, layout_config, intro_config, menu_config, language, exit_command, exit_message, ui_font_size, screen_saver_timeout, displays_menu_exit, hide_brackets, group_clones, startup_mode, confirm_favourites, confirm_exit, mouse_threshold, joystick_threshold, window_mode, screen_rotation, filter_wrap_mode, track_usage, multiple_monitors, smooth_images, selection_max_step, selection_speed_ms, move_mouse_on_launch, scrape_snaps, scrape_marquees, scrape_flyers, scrape_wheels, scrape_fanart, scrape_videos, scrape_overview, thegamesdb_key, power_saving, video_decoder, menu_prompt, menu_layout, image_cache_mbytes
Config: /home/seamonkey/.attract/attract.cfg

*** Initializing display: 'Sega Saturn'
 - Loaded master romlist 'Sega Saturn' in 0 ms (284 entries kept, 0 discarded)
 - Constructed 2 filters in 0 ms (568 comparisons)
Error opening input file: /home/seamonkey/.attract/sounds/
Error loading sound file: /home/seamonkey/.attract/sounds/


WARNING: some options in attract.cfg clash with Arcadeflow

 - Loaded layout: /home/seamonkey/.attract/layouts/Arcadeflow/ (layout.nut)

*** Initializing display: 'Sega 32X'
 - Loaded master romlist 'Sega 32X' in 8 ms (34 entries kept, 0 discarded)
 - Constructed 2 filters in 0 ms (68 comparisons)
Failed to add a new character to the font: the maximum texture size has been reached
[1]    31953 segmentation fault (core dumped)  attractplus

Is this the same issue when changing to Sega 32X display? I thought I fixed previously, must be some changes in the internal font rendering. I see the first display mentioned is Sega Saturn, so when it actually crashes? When entering Sega 32X or Sega Saturn?

PS: Remove default_font and font_path from your attract.cfg file, they are not needed in AM 3.0.4 :)

Saturn works. 32X crashes.

Are you sure it is the same Sega 32X and not Super 32X or a similar logo? It's strange because it worked in the past and I didn't change the layout fonts recently. Did you change something on your system?

Yes, it's 32X. I wiped and re-cloned the repository just in case and got the same crash.

Could you try changing the name of the layout to Super 32X so we can check if the logo for the Japanese 32X works better?

Super 32X works.

I have patched the Sega 32X font, not sure if it will work because it doesn't fail on my system, but you can check if it works on yours... You can try it downloading the test_32x branch, sorry but I couldn't retrofit the font to 16.1, so I'm using the 16.2 release candidate as test bench. Let me know if it works...

It works!

Experiencing this again with the 32X on 17.3.