Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [Graphics] Fix occasional overflow occuring when interfacing with fonts. #2281

Closed
wants to merge 1 commit into from

Conversation

Eideren
Copy link
Collaborator

@Eideren Eideren commented May 25, 2024

PR Details

See title, this can often be seen when running tests like TestDynamicSpriteFont, more below.

Related Issue

Similar to #1700
And Robmaister/SharpFont#121 which is on the repo of the source we currently run on.
If you follow that issue you can see that it hasn't yet been addressed, thankfully SharpFont.NetStandard did.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have built and run the editor to try this change out.

@Eideren Eideren changed the title [Graphics] Fix occasional overflow occuring when interfacing with fonts. fix: [Graphics] Fix occasional overflow occuring when interfacing with fonts. May 25, 2024
@Basewq
Copy link
Contributor

Basewq commented Jun 7, 2024

It worked fine in the editor for me but when I tried this on a game project, and it crashes with the exception

[Game]: Error: Unexpected exception. System.DllNotFoundException: Unable to load DLL 'freetype6' or one of its dependencies: The specified module could not be found. (0x8007007E)
   at SharpFont.FT.FT_Init_FreeType(IntPtr& alibrary)
   at SharpFont.Library..ctor()
   at Stride.Graphics.Font.FontManager..ctor(IDatabaseFileProviderService fileProviderService)
   at Stride.Graphics.Font.FontSystem.Load(GraphicsDevice graphicsDevice, IDatabaseFileProviderService fileProviderService)
   at Stride.Rendering.Fonts.GameFontSystem.LoadContent() in C:\_Github\stride\sources\engine\Stride.Rendering\Rendering\Fonts\GameFontSystem.cs:line 36
   at Stride.Games.GameSystemBase.Stride.Games.IContentable.LoadContent()
   at Stride.Games.GameSystemCollection.LoadContent()
   at Stride.Games.GameBase.LoadContentInternal()
   at Stride.Engine.Game.LoadContentInternal() in C:\_Github\stride\sources\engine\Stride.Engine\Engine\Game.cs:line 458
   at Stride.Games.GameBase.InitializeBeforeRun()

Looking at the source code, they define theirs as "freetype6"
https://github.com/vonderborch/SharpFont/blob/f1338ecaebb216c53d0da7e160c94d4236c89ff9/Source/SharpFont/FT.Internal.cs#L86

Unless I've messed up my dev build, still Stride.Graphics supplies freetype.dll (no '6' suffix)
and FontManger also preloads as "freetype"

NativeLibraryHelper.PreloadLibrary("freetype", typeof(FontManager));

Not that I'm for or against this, but re you sure you want to just swap the library rather than sync up the Stride's one? This repo is also 'dead' since its last commit was 3 years ago.

EDIT: Stride's fork renamed freetype6 to freetype as per this commit
stride3d/SharpFont@9bad591

@Eideren
Copy link
Collaborator Author

Eideren commented Jun 7, 2024

You're right, although the two forks don't merge that easily because SharpFont.NetStandard duplicated the project and worked on the duplicate instead of working off of the main one, nevertheless, I copied the corresponding files over ours and filtered the IOs specific stuff locally, I haven't made a PR about this yet because I just couldn't make it work ...
No clue why but with that new dll the error pops up again, I've tried tons of stuff, even building their project and using their native dlls doesn't work. Going back to their nugget does work fine though.
I think I'll just close this PR off, I don't want to dedicate anymore of my time to it, I hate working with build stuff and I have a lot more important stuff I could be focusing on instead of this one ...
If anyone wants to take over, I left the merge over on branch stride_fix_overflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants