简体   繁体   English

如何在android中使用tamil字体

[英]how to use tamil font in android

this is my tamil UTF-8 unicode string 这是我的泰米尔UTF-8 unicode字符串

"\à\®\œ\à\¯\†\à\®\©\à\®\¿\à\®\²\à\®\¿\à\®\¯\à\®\¾ \à\®\ª\à\¯\\à\®\•\à\¯\ˆ\à\®\ª\à\¯\\à\®\ª\à\®\Ÿ\à\®\®\à\¯\" “\\ u00e0 \\ u00ae转移\\ u009c \\ u00e0 \\ u00af \\ u0086 \\ u00e0 \\ u00ae转移\\ u00a9 \\ u00e0 \\ u00ae转移\\ u00bf \\ u00e0 \\ u00ae转移\\ u00b2 \\ u00e0 \\ u00ae转移\\ u00bf \\ u00e0 \\ u00ae转移\\ u00af \\ u00e0 \\ u00ae转移\\ u00be \\ u00e0 \\ u00ae转移\\ u00aa \\ u00e0 \\ u00af \\ u0081 \\ u00e0 \\ u00ae转移\\ u0095 \\ u00e0 \\ u00af \\ u0088 \\ u00e0 \\ u00ae转移\\ u00aa \\ u00e0 \\ u00af \\ u008d \\ u00e0 \\ u00ae转移\\ u00aa \\ u00e0 \\ u00ae转移\\ u009f \\ u00e0 \\ u00ae转移\\ u00ae转移\\ u00e0 \\ u00af \\ u008d”

i want to decode it and display the tamil font 我想解码它并显示泰米尔语字体

in android is this posible,how to do ? 在android中是这个posible,该怎么办?

please help me 请帮我

You can save the tamil (ttf) font in the assets folder, and use it like this: 您可以将tamil(ttf)字体保存在assets文件夹中,并像这样使用它:

TextView text; // initialize to your textview
Typeface tf = Typeface.createFromAsset(this.getAssets(),"fonts/tamil.ttf");
text.setTypeface(tf);

The best way to display tamil in android is to use TSCII font as described here . 在android系统显示泰米尔人的最好方法是使用TSCII字体作为说明这里 Unicode is not yet fully supported. Unicode尚未完全支持。

Step 1: Download a tamil font .ttf file. 第1步:下载tamil字体.ttf文件。 (For example say kanchi.ttf ). (比如说kanchi.ttf )。

Step 2: Now create a directory " fonts " in your assets folder in the android project. 第2步:现在在android项目的assets文件夹中创建一个目录“ fonts ”。

Step 3: Now copy the kanchi.ttf file into assets/fonts folder in you Android project. 第3步:现在将kanchi.ttf文件复制到Android项目中的assets/fonts文件夹中。

Step 4: Add these lines to your onCreate() 第4步:将这些行添加到onCreate()

protected static Typeface tamil = null;
tamil= Typeface.createFromAsset(getAssets(),"fonts/kanchi.ttf");

Step 5: Now provide this typeface to your TextView you want. 第5步:现在为您想要的TextView提供此字体。

    textview= (TextView) findViewById(R.id.tipstext);
    textview.setTypeface(tamil);
    textview.setTextSize(20);
    textview.setText( "nkZk;");

if you are using webview, place the your font file 'tamilfont.ttf' in the assets folder. 如果您使用的是webview,请将您的字体文件'tamilfont.ttf'放在assets文件夹中。 and the java code will be similar to this. 和java代码将类似于此。 notice the font is applied in the css 注意字体是在css中应用的

    data = "<html><head><style>@font-face {font-family: 'tamilfont';src: url('file:///android_asset/tamilfont.ttf');} h1 { font-family: 'tamilfont'; } </style></head><body> <h1>தமிழன்!</h1> </body></html>"; 
    WebView wv = (WebView)findViewById(R.id.webview);
    wv.loadDataWithBaseURL(null, data, "text/html", "UTF-8", null);

this approach does not work in android 2.0 and 2.1. 这种方法在android 2.0和2.1中不起作用。

我有一个打开泰米尔语字体转换doc到pdf然后尝试在Android手机中打开

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM