Getting Fonts to load in visual studio

Hello,

I am trying out some of the examples for UI on my new G120E development board. I am currently trying to get a text box to work according to the example on
Fonts

But I am having some trouble with getting the NinaB.tfct font to load in visual studio because GetFont() or FontResources does not seem to be a recognized method.

image

I appreciate any help!

Did you add the font to your project resources?

yes sir.

image

Any hints in the Resource1.Designer.cs code?

the fact that intellisense has told you the code behind Resource1.GetFont doesn’t exist should be the evidence that you haven’t added the resource properly, as that gets auto-added when a valid font file is added correctly… I think you should rip the resource apart and re-add.

Brett, I looked into the Resource1 designer and I can see that it added the file as a binary file.
Not sure if that is what is needed for a font but some other threads on the forum suggested that was what was needed.

Is there a paticular way I should be adding fonts to the resources outside of what is explained in the link below?
https://docs.ghielectronics.com/software/tinyclr/tutorials/resources.html

Below is a screenshot of my Resource1.Designer.cs

There is no auto generated code for GetFonts in the Resource1.Designer code. But I am not sure how to get it to do that.

We have nice docs for near everything http://docs.ghielectronics.com/software/tinyclr/tutorials/graphics/font.html

Gus,

I have followed those tutorials as best as I could over the last 7 days and they have left me in this dilemma.They must be omitting some key information that is key to making this work.

I am trying to take baby steps here at first. I am avoiding the conversion of fonts for now and just trying to get the already created NinaB font that is available for download in some other how tutorials to work.

Based on the help I received from others on the forum so far the problem seems to be how the font file is being added to the Resources in the project. I understand that the resource designer should be used so the underlying code will get auto generated in visual studio.

However, what file type do I use to add a font so that visual studio will auto generate a GetFont Method in the Resource.Designer.cs??

Thanks

You can’t use old NETMF fonts with TinyCLR anymore, you need to use the font converter tool to generate them. Our VS extension doesn’t recognize them as fonts so it adds them as binary resources instead.

1 Like

Thank you so much!!! I will definitely try this as soon as I can.

It is probably worth adding a tip to the documentation explaining that.

Marlon

We’ve added a note that should make its way to the live site in a few days

1 Like

John,

I downloaded the TinyCLR OS Font Converter tool. v1.0.0 but when i launch it a cmd prompt briefly launches and then disappears and then nothing happens.

I tried to run it as an administrator but the same thing happens again.
I am running windows 10 on a surface pro 4.

Thanks,

read the other thread. Open Command Prompt and navigate to the location and run the tool like the picture says………

Thanks Brett!