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

Issue with iOS Fonts #2005

Closed
jonathanpeppers opened this issue Sep 19, 2013 · 26 comments
Closed

Issue with iOS Fonts #2005

jonathanpeppers opened this issue Sep 19, 2013 · 26 comments

Comments

@jonathanpeppers
Copy link
Contributor

See full details here: http://stackoverflow.com/questions/18857318/monogame-spritefont-not-working-on-ios

Basically I'm having trouble getting a basic *.spritefont to load on iOS when built properly from the MonoGame content pipeline. "MonoGame SpriteFont from Texture" works fine, but it is difficult to use these for non-Latin languages.

Is this currently supposed to be working?

@totallyeviljake
Copy link
Contributor

mr. peppers - do you see any unusual output during the build process? The output window should contain a statement such as "MonoGame iOS Platform", or similar.

@jonathanpeppers
Copy link
Contributor Author

All I'm seeing are lines like this:

Building Fonts\Arial_16.spritefont -> F:\MyPath\bin\x86\Release\Content\Fonts\Arial_16.xnb

Do I need to turn on a higher log level during build?

I do feel like it's running through the MonoGame pipeline though, because my source control shows the file is different if I change the content processor to the XNA one.

@CartBlanche
Copy link
Contributor

@jonathanpeppers Probably not related, but are you using a normal Arial font to get these Chinese characters or Arial Unicode?

@jonathanpeppers
Copy link
Contributor Author

For this issue, I'm using English only with only English character ranges. Basically used the default *.spritefont template and changed it to Arial.

@totallyeviljake
Copy link
Contributor

hehe: F:\MyPath\bin\x86\Release\Content\Fonts\Arial_16.xnb

This is no bueno. It should be output in "bin\iOS..." if you are indeed using the iOS content builder.

@jonathanpeppers
Copy link
Contributor Author

Have this in csproj:

<Import Project="$(ProjectPath)..\MyPath\MonoGame.ContentPipeline.targets" /> <PropertyGroup> .. <MonoGamePlatform>iOS</MonoGamePlatform> </PropertyGroup>

Tried adding to the main XNA application, same results.

Then my font is setup like this in the content .csproj:

<ItemGroup> <Compile Include="Fonts\Arial_9.spritefont"> <Name>Arial_9</Name> <Importer>FontDescriptionImporter</Importer> <Processor>MGSpriteFontDescriptionProcessor</Processor> </Compile> </ItemGroup>

What is missing to set this up?

@Aspyroad
Copy link

I can confirm I am having the exact same issue on iOS. Any ideas as to what may be the cause?

I work off the develop fork and I thought there may have been a problem based on the age of this thread, but it turns out as usual the problem was me ... lol.

@tomspilman
Copy link
Member

Hum... maybe try this. Open up a command line window and enter:

set MONOGAME_PLATFORM

This should come back and tell you that the environment variable is not defined. If not do:

set MONOGAME_PLATFORM=

Which will clear it. The latest .target file deals with this and keeps it from happening, but maybe you are working from an older version.

@jonathanpeppers
Copy link
Contributor Author

I don't think it's defined on my machine:

Environment variable MONOGAME_PLATFORM not defined

I tried updating the latest .target file, and my source control says it's the same file.

@tomspilman
Copy link
Member

Do you see...

MonoGame Platform iOS

... in the build output? That is printed from the .targets file if the platform is properly set.

Also maybe be sure the content assemblies are not blocked from execution (Properties -> Unblock).

@jonathanpeppers
Copy link
Contributor Author

I checked, those DLLs aren't blocked.

I raised the MSBuild log level in VS, and I see it:

MonoGamePlatform = iOS

@tomspilman
Copy link
Member

I raised the MSBuild log level in VS, and I see it:

You do not need to elevate the log level.

What you wrote there is different. This...

MonoGamePlatform = iOS

... is not this...

MonoGame Platform iOS

That text specifically comes from a Message in the .targets file:
https://github.com/mono/MonoGame/blob/develop/MonoGame.ContentPipeline/MonoGame.ContentPipeline.targets#L21

If you do not see that line as I wrote it, that means the target is not executing and the content processor will not see the platform identifier and will build stock XNA content.

@totallyeviljake
Copy link
Contributor

Mr. Peppers, are you using Ray's old skeleton content builder, or the new MonoGame content builder?

@jonathanpeppers
Copy link
Contributor Author

I'm using the content builder in here: https://github.com/mono/MonoGame/tree/develop/MonoGame.ContentPipeline

Should I be using the newer one now?

Is there a working example I can compare my project to?

@totallyeviljake
Copy link
Contributor

Try this one:

MonoGame\Tools\MGCB

Otherwise, you could use our content builder at:

https://github.com/Cocos2DXNA/cocos2d-xna/tree/master/tests/iOSContent/ContentBuilder

The stock content pipeline project you are using, I found, did not always select iOS correctly, so I shamelessly hacked it to always do iOS for Cocos2d-XNA and our games. @dellis1972 might have something for you on the iOS content builder frontier. He's been deep into that side lately.

@totallyeviljake
Copy link
Contributor

Here is @dellis1972 work:

#1937

You could merge this into your local and I bet you would be able to continue with the content build on iOS.

@jonathanpeppers
Copy link
Contributor Author

Thanks @totallyeviljake,

Because of a time crunch, we ended up using this hack method for fonts: http://kelthar.wordpress.com/2010/09/04/loading-spritefonts-faster-with-xnatouch/

Of course I cleaned it up, it was a little rough.

We've been using this since about MonoGame 2.5, but I'm not a fan because it requires making SpriteFont's constructor public.

I'll mess with your examples and see if I can figure out what we're doing wrong.

@jonathanpeppers
Copy link
Contributor Author

Ok, for future reference:

  • Put the <Import> statement in the XNA main project (not content project)
  • Put <MonoGamePlatform> in the XNA main project
  • Put <MonoGamePlatform> in the XNA content project

When it wasn't working for me, I had everything in the content project and nothing special setup in the main XNA project.

Is there a way we could make a supported MonoGame project template for this stuff? Or is it because the pipeline is getting rewritten, that this stuff will be deprecated one day anyway?

@tomspilman
Copy link
Member

Put <MonoGamePlatform> in the XNA content project

You don't need to do that... it only needs to go in the XNA main project.

It is weird... but the XNA content project never really compiles. The XNA main project is what actually does the content building and that is why <MonoGamePlatform> goes there.

Is there a way we could make a supported MonoGame project template for this stuff?

Technically there is one, but it is a stand alone content project without a game associated to it.

I can see about getting a content project in the default templates for at least the Windows desktop platforms.

@jonathanpeppers
Copy link
Contributor Author

Ok, great, nice to know.

You can probably resolve this issue. But I bet a lot of people will have trouble with it.

How long until all the XNA pipeline will be dropped completely? We can maybe put some time toward helping with that.

@tomspilman
Copy link
Member

How long until all the XNA pipeline will be dropped completely?

Hard to say.

The big holes still left:

  • FBX import w/ animation.
  • X import.
  • Mesh/model processors.
  • Effect processor on Linux/Mac.

We can maybe put some time toward helping with that.

We can always use help.

You should probably sync up with us on what area you want to help with as someone else may be working on it too.

@nightst4r
Copy link
Contributor

It looks like the Autodesk SDK supports Windows mac and linux for FBX loading support.

http://usa.autodesk.com/adsk/servlet/pc/item?siteID=123112&id=10775847

Is that the solution you were hoping to use? I know its pretty heavy i think it comes over at something like 8mb compiled. Are there any other cross platform FBX solutions out there?

I have a variant of the example fbx loader compiled that I use to load fbx files on the fly in my monogame level editor.

@tomspilman
Copy link
Member

Is that the solution you were hoping to use?

The issue isn't finding a loader to use.

We're using AssImp which supports a bunch of import formats including FBX.

The issue is translating the loaded data into the correct XNA content objects and doing the processing on them. We have done some work there and we can load simple meshes, but we don't have full material support and don't have any support of animation data.

@nightst4r
Copy link
Contributor

If i remember correctly XNA only support animations on skeletal meshes? I believe it was a 3rd party codeplex extention for normal object animation?

@tomspilman
Copy link
Member

Yes, but we still have to import the data and provide it in the various content objects to the processors.

@jonathanpeppers
Copy link
Contributor Author

This is so old, it should be closed.

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

No branches or pull requests

6 participants