Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Insert NSAttributedString using custom keyboard extension?

I want to write text in some custom fonts using keyboard Extension as these apps (1,2,3,4) are doing. I know how we can insert normal string in document proxy.

    [self.textDocumentProxy insertText:mystring];

I have tried to insert NSAttributedString using above approach but I can't see any way to insert NSAttributedString to document proxy.

Some one can guide what will the best way to get rid of this issue? any suggestion will be appreciated.

like image 850
jamil Avatar asked Mar 09 '15 11:03

jamil


1 Answers

It is not possible to insert attributed strings (or otherwise rich content) using the text document proxy.

The keyboards you have linked are not using custom fonts. They use (or abuse) Unicode symbols such as Enclosed Alphanumerics and Enclosed Alphanumeric Supplement.

In other instances, different alphabet symbols with visual similarity to latin symbols are used to create "funky" text, like here.

Last, some keyboard extensions, like the image keyboards, use the pasteboard to copy the rich content, and the user is responsible to paste it where he seems fit.

like image 116
Léo Natan Avatar answered Oct 09 '22 18:10

Léo Natan