Copy Text converted using TTf fonts to clipboard

60 views Asked by At

I've extensively searched the depths of the internet, eager to seamlessly incorporate TTF font styling to user input. With a vast repository of over 12,000 TTF font files hosted on my website, the current functionality generates input text as PNG files. However, I'm now enthusiastic about enabling users to directly copy applied styled text using Ttf fonts. I'm open to exploring solutions in any programming language. Feel free to review my current implementation here: https://update.cutestfonts.com/. I'm flexible and capable of working with any programming language or solution.

I tried converting the ttf font to woff and then use to output the text, but when someone copies it doesn't pick the ttf font style. I tried manipulating the current code like imagettftext() but no success.

1

There are 1 answers

0
Mohammad Mehrabi On

This is not possible.

Because the font is not applied to the text and is applied to the visible output for you. Therefore, the font will never be a part of your text and you will not be able to copy or share it as text. The solution for your case is to provide an image output to the user and copy, share or save the generated image of the text with the font applied.

Of course, the explanations provided are for file fonts with specific formats. Otherwise, there are some limited characters that can be used to write the desired text with a certain style, which is not available in all languages and is not a suitable approach to use. The best approach is what was said, that is, using the method of creating an image for the user