Search code examples
androidhtmlfontsandroid-edittextclipboardmanager

Copy text and font to clipboard


I'm working on a font App in which I've incorporated over 150 .ttf fonts into. You're able to select a font, type out a message in an editText and then apply the font to another editText.

Once the text has been placed in the second editText and that editText has the selected font applied on it, how can I copy the text and it's font to the clipboard upon a button click?

I know how to set up button clicks and what not, but I need some help understanding how to apply the font to the clipboard so that it can be pasted outside the app with the font. When just selecting it out of the editText and copying it to the clipboard, it doesn't keep its font.

Here's an example of an app that allows for the font to be copied to the clipboard like I'm seeking to learn how to do:

https://play.google.com/store/apps/details?id=com.chudanqing.specialfonts&hl=en

Spent a long time searching for a solution/explanation on how this app is able to copy fonts to the clipboard, any information on how they accomplish this and how I can go about accomplishing this as well would be greatly appreciated!


Solution

  • Apps similar to this don't actually copy the .ttf files to the clipboard, these characters that you are seeing are actually special unicode characters such as :

    ⓡⓞⓛⓛⓘⓝⓖ ⓑⓐⓛⓛⓢ

    cutє wσrdѕ

    s̰̃ã̰ñ̰d̰̃w̰̃h̰̃ḭ̃c̰̃h̰̃

    ℘Ԅıŋɕɛ ơʄ ℘ɛԄʂıą

    ㎡∆∂ ㄅςⅰ∑иɬⅰㄅɬ

    ą ąცıąŋ

    b̰̃ã̰c̰̃õ̰ñ̰

    [̲̅b̲̅][̲̅o̲̅][̲̅x̲̅][̲̅e̲̅][̲̅d̲̅]

    s̸t̸r̸i̸k̸e̸