Font Glyphs

Hi all,

I do own the MBS and Einhugur plugins, so solutions using them are appreciated as well :wink:

I want to retrieve all characters/glyphs contained in an icon font and paint them into a graphics object. How can I do that?
Unfortunately, the new CoreText functions of the MBS plugins lack examples and the documentation is a bit… overwhelming :slight_smile:

Best,
Alex

But CoreText may be the way to go.

I felt so - thus asking for a little guidance here :slight_smile: A little hint into the right direction would be appreciated.

[quote=111630:@Alex von Siebenthal]Hi all,

I do own the MBS and Einhugur plugins, so solutions using them are appreciated as well :wink:

I want to retrieve all characters/glyphs contained in an icon font and paint them into a graphics object. How can I do that?
Unfortunately, the new CoreText functions of the MBS plugins lack examples and the documentation is a bit… overwhelming :slight_smile:
[/quote]

If you want to create sprites of sorts with a collection of pictures representing each a character, the solution I would use is through Graphics.DrawString and the size of each graphic set by StringWidth. You may not need declares at all. But why not use the font itself as a custom font in your app ?

I can try to write something.

I tried that but icon fonts do not have a glyph at every character point (eg. char(100) might be empty). Thus I somehow need to get all the glyphs and their position available. Kind of a glyph map the way OS X has it.

I want to end up with a tool that helps me create icons from icon fonts (like FontAwesome) in various sizes and forms.

[code] dim font as CTFontMBS = CTFontMBS.CreateWithName(“Comic Sans MS”,18)
dim c as CFCharacterSetMBS = f.CharacterSet

for i as integer = 0 to 65535
if c.IsMember(i) then
List.AddRow str(i), encodings.UTF8.Chr(i), “?”
end if
next[/code]

I think you only need to know which characters are inside.

Awesome, thanks Christian. Gonna try that. Can I also pass a font by FolderItem? The font is not installed.

Please use RegisterFontsForFile in CoreTextMBS to register it with a local scope for your app only.