How can i use malayalam ASCII fonts?

Asif Lijaz

I am a beginner in app developers.I am facing a problem while adding ASCII fonts in Text View.How can i add some text in the text box which are in ASCII.

Biraj Zalavadia

There are two approach that you can use

1) If data is contains HTML along with ASCII.

 txtview.setText(Html.fromHtml(asciiString));

2) If data is contains only ASCII.

try {
        textView.setText(new String(asciiString.getBytes("UTF-8"),"UTF-8"));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

Example:

MainActivity.java

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);
        TextView textView = (TextView) findViewById(R.id.textView);

        try {
            textView.setTypeface(Typeface.createFromAsset(getAssets(), "APPLET.TTF"));
            textView.setText(new String("bYmÀ° AÀlXbpÅh³".getBytes("UTF-8"),"UTF-8"));

        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

    }

}

activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
     >

   <TextView
       android:id="@+id/textView"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       />

</RelativeLayout>

Outout:

enter image description here

NOTE:

Put APPLET.TTF file in assets folder of your project

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I use google web fonts with phantomjs

From Dev

How can I download WOFF files from Google Fonts?

From Dev

How can I import .woff fonts my site

From Dev

How can i add fonts in Pyrocms?

From Dev

How can I use non-ASCII characters?

From Dev

How can I show the text with different fonts in textView in ios?

From Dev

How can I get PixlUI for Android custom fonts working?

From Dev

How can I install custom fonts using Bower? (not Font Awesome)

From Dev

How can I only use Latin subset with Google Fonts WOFF2 files?

From Dev

How can I make a list-style-image scale with the list's font size, when we can't use glyph fonts?

From Dev

How can I vertically center a line in an NSAttributedString with different fonts?

From Dev

How can I add the fonts in editor of Android Studio

From Dev

How to use Museo fonts?

From Dev

How can I combine multiple styles of fonts into one rule?

From Dev

How can I download and install fonts dynamically to iOS app

From Dev

Ugly fonts in Netbeans - How can i make it use the system font?

From Dev

How can I "install" fonts to use in Visual Studio Code?

From Dev

How can I get smooth fonts in LyX?

From Dev

Ugly fonts in Netbeans - How can i make it use the system font?

From Dev

How can I "install" fonts to use in Visual Studio Code?

From Dev

How can I use iOS6 fonts in iOS5

From Dev

How can I use google web fonts with phantomjs

From Dev

How can I use powershell to create an ascii to hex converter in batch?

From Dev

How to type Malayalam in Ubuntu?

From Dev

How can I type in Malayalam on Ubuntu 16.04?

From Dev

Regional Fonts (Malayalam) not readable in LO 5.3

From Dev

How can I get italic fonts in byobu

From Dev

Qt setStyleSheet which kind of fonts can I use?

From Dev

How do I program an LCD to only use custom fonts?

Related Related

  1. 1

    How can I use google web fonts with phantomjs

  2. 2

    How can I download WOFF files from Google Fonts?

  3. 3

    How can I import .woff fonts my site

  4. 4

    How can i add fonts in Pyrocms?

  5. 5

    How can I use non-ASCII characters?

  6. 6

    How can I show the text with different fonts in textView in ios?

  7. 7

    How can I get PixlUI for Android custom fonts working?

  8. 8

    How can I install custom fonts using Bower? (not Font Awesome)

  9. 9

    How can I only use Latin subset with Google Fonts WOFF2 files?

  10. 10

    How can I make a list-style-image scale with the list's font size, when we can't use glyph fonts?

  11. 11

    How can I vertically center a line in an NSAttributedString with different fonts?

  12. 12

    How can I add the fonts in editor of Android Studio

  13. 13

    How to use Museo fonts?

  14. 14

    How can I combine multiple styles of fonts into one rule?

  15. 15

    How can I download and install fonts dynamically to iOS app

  16. 16

    Ugly fonts in Netbeans - How can i make it use the system font?

  17. 17

    How can I "install" fonts to use in Visual Studio Code?

  18. 18

    How can I get smooth fonts in LyX?

  19. 19

    Ugly fonts in Netbeans - How can i make it use the system font?

  20. 20

    How can I "install" fonts to use in Visual Studio Code?

  21. 21

    How can I use iOS6 fonts in iOS5

  22. 22

    How can I use google web fonts with phantomjs

  23. 23

    How can I use powershell to create an ascii to hex converter in batch?

  24. 24

    How to type Malayalam in Ubuntu?

  25. 25

    How can I type in Malayalam on Ubuntu 16.04?

  26. 26

    Regional Fonts (Malayalam) not readable in LO 5.3

  27. 27

    How can I get italic fonts in byobu

  28. 28

    Qt setStyleSheet which kind of fonts can I use?

  29. 29

    How do I program an LCD to only use custom fonts?

HotTag

Archive