Glyphs available as images?

1 Answer 93 Views
General Discussions
Philipp
Top achievements
Rank 2
Iron
Philipp asked on 02 Dec 2021, 10:45 AM

Hello,

I quite like the icons provided as glyphs (https://docs.telerik.com/devtools/wpf/styling-and-appearance/glyphs/common-styles-appearance-glyphs-reference-sheet#glyphs-reference-sheet) and they cover a lot of needs.

In my current application I have additional icons for very specific use cases (no glyph nearly matches) as images (vector graphics). Using glyphs results in two sources for icons that must be maintained and both source types must be supported in code.

I'm not really happy with this approach. I would prefer one source where all icons are stored. So I was wondering if the glyphs are available as images? Then I could add them to my other icons and handle everything from one source.

 

Regards

Philipp

1 Answer, 1 is accepted

Sort by
0
Accepted
Martin Ivanov
Telerik team
answered on 02 Dec 2021, 03:02 PM

Hello Phillip,

The glyphs from the Telerik's glyph font are not distributed separately as images. However, you can achieve your requirement by manually exporting the glyphs to images. For example, you can research for tools that allows you to provide a font file and return a set of image files. If you find anything useful on this topic, you can download the source code of Telerik UI for WPF where you can find the TelerikWebUI.ttf font file (at "source code folder\Core\Controls\Themes\Fonts").

Alternatively, you can use the RadGlyph extension methods to create your own tool that goes through each glyph from the Reference Sheet (using its code) and converts it to an image that you can save to the file system. For example:

public ImageSource GetGlyphImageSource(string glyphCode)
{
	var source = RadGlyph.GetImageSource(this.GetGlyph(""), 12, new SolidColorBrush(Colors.Black), "TelerikWebUI");
	return source;
}

private string GetGlyph(string hexCode)
{
	string glyphInt = hexCode.Substring(3, 4);
	var character = (char)int.Parse(glyphInt, NumberStyles.HexNumber);
	return character.ToString();
}

//-------------------
ImageSource glyphImage = GetGlyphImageSource("");
// save glyphImage to a file

I hope this information helps.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Philipp
Top achievements
Rank 2
Iron
commented on 03 Dec 2021, 09:53 AM

Hello Martin,

 

Thanks for the hint.

I was able to get the ttf file and extracted the needed icons with an open source font editor (don't want to make advertisement. Just search for "open source font editor" with google ;) ).

Works for me. Thanks

Martin Ivanov
Telerik team
commented on 03 Dec 2021, 10:14 AM

I am glad to hear this. And thank you for the hint.
Tags
General Discussions
Asked by
Philipp
Top achievements
Rank 2
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or