Copy the text with the font in the Android application - android

In some Android programs, you can copy text with a specific font and paste it in other programs, but how do they work?
like this:
𐎢𐎲𐎢
I want to show a text with its font to the user and allow him to copy it, but like the example above, I want its style to be copied as well, but only the normal text is copied.
like this: abcd
But what I want is this : 𐎷

Related

Copy text with all the font properties and paste it anywhere

I want to copy text with the same font style, same font color from TextView in Android application and paste it anywhere(like message app, WhatsApp etc.) with all the TextView font properties (style, color, size etc.).
I use a .ttf file for different font style.
How to copy that text with all the properties?
Short answer: you can't.
The copy-paste option is a system operation, and even if you'd find a way to change it to get in all the font properties, it still depends on the receiving applications to implement your custom paste and also to have the same .tff files for the custom fonts, etc..

Create a Text with a special structure

Is there a way to write and save a Text with a special structure ? So I want for example sth like this in my Text File :
This is a
structured
Text in
android
There should be also Tabs etc. I thought to make a Word Document but cant find a solution ...

HTML android in android

I want to develop an editor which can make the text bold, italics and underline and create an equivalent HTML for it. I have somethhing like this in my mind:
When the user clicks on save, I should get HTML data.
For example , if user writes:Hello World
then I should get <!Doctype HTML><body>Hello <b><i>World</i></b></body></html>
What are my options here? are there any previous projects like this or do i have to make this from scratch?
You can use Character Style sub-classes of Android for the styling of your texts. Then use HTML class to get the HTML equivalent of your text. I'm currently developing one and those are the ones I used. You may also check out https://github.com/commonsguy/cwac-richedit for an example on how you could use Character Style for editing. :)

How to edit TextView Android?

I want to load a text file in Android with custom size and color just as shown in the website (download the 1.html file). This is a HTML file and I have used WebView to show the file but I want to show using TextView. If I simply copy this in Text file it deletes the custom color and the size. Is there any easy way using Java code like loop or something to make specific lines in Red color and the other in black to make it look like it's shown in HTML File?
https://sites.google.com/site/gurbaniujagar/page1
Thanks in advance
Take a look at this site here, it shows you all you need to know.
http://javatechig.com/2013/04/07/how-to-display-html-in-android-view/

Android - Combining multiple font styles, into one single font (Typeface)

I have several fonts with different styles, lets say: "MyFont_default.otf", "MyFont_italic.otf", "MyFont_bold.otf"
Normally, I would set the font of a TextView like this:
Typeface tf=Typeface.createFromAsset(context.getAssets(), "MyFont_italic.otf");
textView.setTypeface(tf);
And my question is: is it possible to combine all these fonts, into one single font, say "MyFont", and depending of the TextView style defined in the XML layout file (italic, bold), the TextView to be displayed in the appropriate font?
I don't have the proper reputation to comment but I can confirm, that approaches work.
Using FontForge (binary available for Windows):
Open your multiple .otf files with FontForge (Regular, Bold, Italic).
Make sure to select the window showing the "Regular" version of the font
Use File > Save ttc from that window
See that indeed the other sub fonts are listed in the save dialog (bold, italic)
Save and use this ttc file in Android
I tested it with an html text displayed in a TextView :
<b>Test</b> Test <i>Test</i>->
"Test Test Test" which didn't work previously in Android 2.3.7 and with this ttc font all three versions of the text show perfectly.
As I said, it's important to select the Regular font when exporting because that's the one Android uses as "default" (I did an export first from the Bold version and it was all Bold).
Use some sort of font editor to combine the fonts into a single file. Many fonts come with multiple styles in a single file, which is what you would need in this case.

Categories

Resources