Android Tamil font between english word

后端 未结 4 1396
心在旅途
心在旅途 2020-12-05 20:02

I am having a TextView that has a huge text in between i have a tamil word and i know how to embedd the tamil font in seperate textview .but i need the tamil word between en

4条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 20:53

    Till ICS (4.0) there were no Tamil font available in Android Systems. Even then it had bugs and Google fixed it all with Jelly Bean (4.2).

    Now if you wanna show Tamil in your application you need to use TAB, TAM, BAMINI or TSCII encodings.

    I wrote a simple library that does the conversion for you dynamically. All you have to write is simple code as below.

    // Initialise the Typeface (assumes TSCII, Bamini, Anjal, TAB or TAM font located inside assets/fonts folder)
    Typeface tf = Typeface.createFromAsset(getAssets(),"fonts/mylai.ttf");
    // Initialises the TextView
    TextView tv = (TextView)findViewById(R.id.textView1);
    //Setting the Typeface
    tv.setTypeface(tf);
    //Magic happens here ;) encoding conversion
    String TSCIIString = TamilUtil.convertToTamil(TamilUtil.TSCII, "வணக்கம் அன்ரொயிட்");
    //Setting the new string to TextView
    tv.setText(TSCIIString);
    

    I have written more on this topic in this answer. Please check it out too.

提交回复
热议问题