How to create bin header file for fonts
I'm able to make xaml embeds using the bin2h tool. I see in the integration sample a font being embedded using a header file containing a byte array as well. I figured the bin2h tool was used for fonts as well so I passed in a font file to test it out, no dice. Is there a tool I can use to do this? If there isn't a tool, can I simply write a quick script to take the contents of the file and write my own header file with the binary contents? Or is it more involved than that?
Re: How to create bin header file for fonts
bin2h is used for all resources in our samples (fonts, textures, xamls, etc).
It is a standard tool to convert a binary file into a C header file. You can reuse that tool instead of creating a new one.
It is a standard tool to convert a binary file into a C header file. You can reuse that tool instead of creating a new one.
Re: How to create bin header file for fonts
Thanks for the info, then this means that I'm either using the tool incorrectly for fonts or there is a bug with the tool. I will search the app framework code again for a place where its being used for fonts.
Re: How to create bin header file for fonts
As you discovered, the Integration sample is using binh for fonts:
Code: Select all
// For this sample we are embedding needed resources using our tool 'binh'
#include "Settings.xaml.bin.h"
#include "HermeneusOne-Regular.ttf.bin.h"
////////////////////////////////////////////////////////////////////////////////////////////////////
void SetResourceProviders()
{
// Each time a resource (xaml, texture, font) is needed, the corresponding provider is invoked
// to get a stream to the content. You must install a provider for each needed resource. There
// are a few implementations available in the app framework (like LocalXamlProvider to load
// from disk). For this sample, we are embedding needed resources in a C array.
NoesisApp::EmbeddedXaml xamls[] = { { "Settings.xaml", Settings_xaml } };
Noesis::GUI::SetXamlProvider(Noesis::MakePtr<NoesisApp::EmbeddedXamlProvider>(xamls));
NoesisApp::EmbeddedFont fonts[] = { { "", HermeneusOne_Regular_ttf } };
Noesis::GUI::SetFontProvider(Noesis::MakePtr<NoesisApp::EmbeddedFontProvider>(fonts));
// Set providers for the theme
NoesisApp::SetThemeProviders();
}
Re: How to create bin header file for fonts
Yes, but i need to find where the font file is being passed in the binh tool, because when I do it, it doesn't work. I don't understand why you are marking this question as resolved? Sorry if I wasn't clear, the binh tool doesn't work when I pass a font in the same way I pass an xaml file into it.
Re: How to create bin header file for fonts
You can view the usage by clicking on any font within Visual Studio. For example, in the HelloWorld sample:
I am confident that there are no bugs in bin2h. :)
Code: Select all
..\..\..\..\..\NoesisSDK\Native\Src\Tools\Bin2h\bin2h.exe "%(FullPath)" > "$(IntermediateOutputPath)%(Filename)%(Extension).bin.h"
Re: How to create bin header file for fonts
The statement "binh tool doesn't work" is a bit too vague. Could you provide more details? Specifically, what input parameters are you using, what output are you getting, and what output were you expecting?
Re: How to create bin header file for fonts
Fixed it. I had made a build script that went through and ran all assets through the tool and a bug in my script for fonts was the issue, even though xaml files worked. Sorry for the trouble.
Passing invalid file to the bin tool causes it to just not return anything. I'm not sure if its worth fixing for you folks.
Passing invalid file to the bin tool causes it to just not return anything. I'm not sure if its worth fixing for you folks.
Who is online
Users browsing this forum: No registered users and 6 guests