How can I use an embedded font in Metro UI app?
Is it possible to use one for Tile Update?
To embed font in your Windows Store app, add the font to your project as "Content", and in your XAML simply write something like:
<TextBlock FontFamily="/Fonts/MyFont.otf#Cool Font"/>
Assuming your font name is "Cool Font", the file name is "MyFont.otf", and you placed in "Fonts" folder
Regarding how to use an embedded font, first take a look at About font embedding. Some of the classes that you might use are CreateFontFace or CreateFontFileReference.
No, there is not a way to change the font on your tile during a tile update (unless of course the font is part of your logo/image that you are sending to the tile). For reference, here is the tile schema for sending live updates to your tile, which doesn't have a way to change the font.
Related
So I'm trying to add a company logo to the middle of my NavigationPage Title section, and I have tried to use NavigationPage.TitleIcon="companytitleicon.png" inside XAML, but it doesn't display. I'm not certain if it's because the image has to be a certain size, and I cannot find information in the documentation.
I played around with other code as well, like calling NavigationPage.SetTitleIcon which takes a reference to a page and a FileImageSource like so:
NavigationPage.SetTitleIcon(this, "/Assets/dischemtitleicon.png");
I may be using it incorrectly, so I need a bit of advice, in general, with getting the logo to display on the Title section. I'll add a screenshot as well to specify the location and size of the logo. The logo is at least twice as wide as the height, eg. 120 x 50 ...
Any assistance will be truly appreciated. I'm also trying to get the colour of the MasterDetail bar to change, but that's not as crucial of an issue. (I added a global StaticResource that applies a fixed colour to all NavigationPage BarBackgroundColors)
If you are using a Xamarin.Forms app based on Shell then you can easily achieve this using Shell.TitleView without the need of a custom renderer, define your title content, bind it or even style it as you like.
You could refer to my similar answer https://stackoverflow.com/a/65062752/522820
I can load the font file using this:
PrivateFontCollection _fonts = new PrivateFontCollection();
_fonts.AddFontFile ( filepath );
Font customFont = new Font(_fonts.Families[0], 6.0F);
But, the problem that I am facing is that I cannot load the font style (Bold/Italics etc) from the font file.
I need the font file from the user, because I am going to save the font file and then use OpenGL to render it. But, before the actual rendering, I need to show a preview using WPF.
All the fonts can be assumed to be system fonts. But, I need to find out the font style from TTF file to show it on WPF Canvas. What I can actually do is that I can ask the user to load a font file as well as specify the style from the drop down, but that defeats the purpose, because if the user specifies a wrong style, then it will show differently on the emulator and during rendering.
So, what should I do?
I'm not sure that I completely understand your problem, but if you want to display some text in a particular font, then you can do it like this. First, add the font file into a folder in your project... let's say it's called Resources. Next, set its Build Action to Content. Then you can use that font in XAML like this:
<TextBlock FontFamily="/Resources/#Some Font Name" Text="Some Font Name" />
I am developing a windows 8 metro Application and I want to add stroke to the text. I found out that there is no built-in function to do that. I tried to overlap two texts with different size but that was not giving the desired result. I want the result that the Cut The Rope is using. Here is a screenshot :
I want the effect where they have written total 36 as the number can vary.
I Unzipped there .xap file and checked there assets to see whether they are using image but there were no image.
I am stuck on this... Please help, I want to achieve this in C#/XAML.
On a quick search I didn't find anything relevant, but you could try something else :
Why not use a font which already has a stroke? You can use a lot of kind of fonts, as long as you add them to your project.
As you can read here, it's quite easy.
Add your font file to your project and set the Build Action from Properties to Content. Then use it in FontFamily in XAML :
<TextBox Text="sampleText" FontFamily="Assets/Fonts/FontFileName.ttf#FontName" />
how can i work with font that dose not support any kind of FontStyle. by the way, I can not create a font Object from it. help??
The font code on Windows (as on any platform I guess) doesn't create new fonts from scratch; it will rather interpret what fonts are installed / available on your system and give you a way to work with those.
Each font is reached by making a FontFamily object; such a FontFamily then contains Font objects for each style that is available. If a certain style (such as 'bold' or 'italic') is not available on your system, you won't be able to create it.
You can test whether this is the case by using the FontFamily.IsStyleAvailable. Defined here as:
public bool IsStyleAvailable(
FontStyle style
)
If you want to create a font, you'll have to make sure it's available on the system first (which means you'll have to use a common font or package the font with your solution if you want an uncommon one).
I'd like to make some fancy live tiles. But I am not quite happy with the default options for it. Is there a way in C#/XAML or any site, that shows how to put an own design for a live tile?
the default font size of the Tile cannot be changed. You can only change the text. What you can do is create an image that has text on it and set that to the BackgroundImage or the BackBackgroundImage. You can create an image by using the WriteableBitmap or WriteableBitmapEx.