简体   繁体   中英

MonoGame SpriteFont not working on iOS

We are having trouble loading a plain Arial spritefont as an XNB in MonoGame on iOS. I tried this using the latest develop branch. These were made on Windows, then followed up in Xamarin studio for the iOS part:

  • We have a stub XNA project with a content project with <MonoGamePlatform>iOS</MonoGamePlatform> defined
  • We also have an <Import> statement pointing to MonoGame.ContentPipeline.targets
  • We referenced MonoGameContentProcessors.dll in the content project
  • Added *.spritefont files with Content Processor set to MonoGame SpriteFont
  • Compiled the project, and copied the resulting XNB into an iOS project with build action set to Content .

I tried this in an empty MonoGame project with Arial 9pt, and I get an exception in Texture2D.cs line 228 where it is checking for OpenGL errors.

We have other fonts in our game that are built as a MonoGame Spritefont from Texture that work fine. But we can't use this method for some languages (Chinese, especially).

I found some other people have this problem: https://monogame.codeplex.com/workitem/7452

Any ideas? Are fonts working on iOS currently?

Here are my compiled XNBs: https://dl.dropboxusercontent.com/u/3702398/Fonts.zip

UPDATE: tried Arial 9, 12, 14, 16, as I heard certain sizes were causing issues. None of them worked.

Opened issue here: https://github.com/mono/MonoGame/issues/2005

I've found the solution from discussion here .

  • Put the statement in the XNA main project (not content project)
  • Put in the XNA main project
  • Put in the XNA content project

I was setting things only in the content project, which is the wrong place. Tom Spilman mentioned you don't need anything in the content project at all, but I just left it because it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM