gazybara
04-20-2012, 01:14 PM
Hi,
I need simpliest solution (ie example) for embeding custom font (True Type or Open Type)
without install it and use after as default font for dotnet label control inside mxs rollout.
I saw an example in which Pete (lonerobot) use functions for converting images to Base64 string
but is it possible to perform the same with a font?
Second request:
How to writte these code as mxs (not compiling)
public static LoadedFont LoadFont(FileInfo file, int fontSize, FontStyle fontStyle)
{
var fontCollection = new PrivateFontCollection();
fontCollection.AddFontFile(file.FullName);
if (fontCollection.Families.Length < 0)
{
throw new InvalidOperationException("No font familiy found when loading font");
}
var loadedFont = new LoadedFont();
loadedFont.FontFamily = fontCollection.Families[0];
loadedFont.Font = new Font(loadedFont.FontFamily, fontSize, fontStyle, GraphicsUnit.Pixel);
return loadedFont;
}
public struct LoadedFont
{
public Font Font { get; set; }
public FontFamily FontFamily { get; set; }
}
Thanks in advance
Branko
I need simpliest solution (ie example) for embeding custom font (True Type or Open Type)
without install it and use after as default font for dotnet label control inside mxs rollout.
I saw an example in which Pete (lonerobot) use functions for converting images to Base64 string
but is it possible to perform the same with a font?
Second request:
How to writte these code as mxs (not compiling)
public static LoadedFont LoadFont(FileInfo file, int fontSize, FontStyle fontStyle)
{
var fontCollection = new PrivateFontCollection();
fontCollection.AddFontFile(file.FullName);
if (fontCollection.Families.Length < 0)
{
throw new InvalidOperationException("No font familiy found when loading font");
}
var loadedFont = new LoadedFont();
loadedFont.FontFamily = fontCollection.Families[0];
loadedFont.Font = new Font(loadedFont.FontFamily, fontSize, fontStyle, GraphicsUnit.Pixel);
return loadedFont;
}
public struct LoadedFont
{
public Font Font { get; set; }
public FontFamily FontFamily { get; set; }
}
Thanks in advance
Branko
