Display ALL characters for a given font?

I bet the MBS way is much faster. You really should consider using it.

I would, if only I could find an example. His site is massive :slight_smile:

From Christian’s help:

[code]Function: An NSCharacterSet object represents a set of Unicode-compliant characters.
Example:
// get the Symbol font
dim n as NSFontMBS = NSFontMBS.fontWithName(“Symbol”,10)

// what characters are defined for this font?
dim c as NSCharacterSetMBS = n.coveredCharacterSet

// display a string with all the characters
MsgBox c.StringValue
[/code]

I don’t know if this is what you want, Richard, but I think it might be.

Simon.

Richard, did you say which platform you need this?
Mac? Win? Linux?

Before people suggest something, they should know that.
And just showing all chr() results doesn’T help as most OS substitute missing characters, so you would see several fonts.

[quote=193984:@Christian Schmitz]Richard, did you say which platform you need this?
Mac? Win? Linux?

Before people suggest something, they should know that.
And just showing all chr() results doesn’T help as most OS substitute missing characters, so you would see several fonts.[/quote]

In the case of Arial, the font does contain most if all of the characters shown, as far as I can tell. I do doubt the validity of such a thing, though. Usually it is intended for a character picker, and am not sure everybody will need to input Amharic. Richard said so little, difficult to know what he may really be after.

[quote=193984:@Christian Schmitz]Richard, did you say which platform you need this?
Mac? Win? Linux?

Before people suggest something, they should know that.[/quote]

Christian, this thread is in the OS X section, so we all should assume that he asks for OS X support.

Oh, sorry. For OS X the way Simon showed with NSFont is probably the easiest one.
Alternative could be CoreText if you need more low level control.

Arial has only 2796 characters here.
Helvetica 2012.
Arial Unicode has 50377 here!

[quote=193997:@Christian Schmitz]Arial has only 2796 characters here.
Helvetica 2012.
Arial Unicode has 50377 here![/quote]

Whatever.

Until Richard explains what he wants to do the exercise appears rather futile. Mac OS X provides an excellent character picker, and since it can be displayed fairly easily from within an app what is the interest of reinventing the wheel ?

Ok.
My OS X app needs to have it’s own character picker, just like the OS provided one. (Clients requirement).

Amharic characters are not really needed, but if it is supposed to show ALL characters for a given font - then I suppose they all have to be listed.

The user can then select the character he requires, and copy it to the clipboard.

Thanks.

I will try Simon’s suggestion, once I work out exactly which MBS plugins need to be installed, in order to do this. The names seem to have changed since the last time I used them?

If I install them all - Xojo takes ages to start, so I need to find out the minimum plugins needed to achieve this.

Thank you everyone.

maybe just start with Cocoa and MacOSX plugins?

Christian,
there are 4 different Cocoa and 3 different OS X plugins.
I presume then, that all 7 plugins are needed to achieve this?

Thanks.

Richard

According to the help file it is the CocoaBase plug-in. I don’t know if there is a dependency within it.

Simon.

Thanks Simon!!

In the compiled app with only those lines I posted the plugin copied to the frameworks folder is CocoaBase (three references to it).

Try it out. It seems to be what you want.

Simon.

Thanks Simon.

CocoaBase may be enough, but there could be a dependency on CG classes in MacOSX.
Not by the parts you use, but by other parts in that plugin.

I try to reduce dependencies, but it’s sometimes impossible.

Here is another idea. Looking at the system character picker, it does not list every character in a font. It displays pages. The most useful, I guess, could be Latin.

Instead of filling the TextArea with a for next, I simply created a document with the Latin page :

!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~??????????????????????????? ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ??????????????????????????????????????????????????????????????????????????????????Œœ????????????Šš??????????????????????Ÿ????Žž???????????????????ƒ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????

I placed that in a constant which I load in the TextArea. Then all I have to do to show all these characters in a given font is simply to set TextArea1.TextFont to that font. This is instant.

That is only the beginning, though. The Mac OS X character picker is not a simple TextArea. It is more akin to a listBox where double clicking the character puts it on the clipboard.

Thanks Michel - I will also try that :slight_smile:

Oops. I forgot some Cyrillic and IPA Phonetic characters in there :wink: