API等级15的北印度语字体(aka Android 4.0.2) [英] Hindi font with API level 15 (aka Android 4.0.2)

查看:88
本文介绍了API等级15的北印度语字体(aka Android 4.0.2)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基于印地语内容的android应用,并使用了来自Android API 16 SDK的devangiri字体,并重命名为hindi.ttf.文本在API级别16和17上可以正常显示,但是在Android API级别15和更低版本上则可以轻松撕开.

I have a hindi content based android app and have used devangiri font from Android API 16 SDK and renamed as hindi.ttf. The text renders fine on API level 16 and 17 but simply tears apart in Android API level 15 and lower.

有什么我能在不删除对较低API级别的支持的情况下解决此问题的原因.我设置textview的代码是:

Is there any why I can fix that without removing support for lower API levels. My code for setting textview is:

import android.app.Activity;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.os.Bundle;
import android.view.GestureDetector;
import android.widget.TextView;

public class Prayer extends Activity {

    // TextSwitcher vs;
    GestureDetector gestureDetector;
    static Tips tip = null;
    static StringBuilder quesString = null;

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

        setContentView(R.layout.prayer);

        TextView tv1 = (TextView) findViewById(R.id.textView1);
        Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/hindi.ttf");
        tv1.setTypeface(tf);
        tv1.setText("श्री");
        tv1.setPaintFlags(tv1.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
    }
}

布局XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#C5C6E1"
    tools:context=".Prayer" >
            <TextView
                android:id="@+id/textView1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content" >
            </TextView>
</RelativeLayout>

当前:

预期:

推荐答案

在开发北印度语应用程序时,我遇到了完全相似的问题.但是,当我更改字体文件时,该错误已解决.

I faced exactly similar issue when I was developing an Hindi app. However, the error resolved when I changed the font files.

此外,恕我直言,设备会简单地将文本中的UTF-8符号替换为字体文件中的相应符号.在这种情况下,其完全显示完全不同的符号.因此,问题应该出在字体文件上.

Also, IMHO the device simply replaces UTF-8 symbols in text with corresponding symbols in font files. In this case, its showing a completely different symbol altogether. So, the problem should be with font files.

如果您想使用我的字体文件,请给我您的电子邮件.

Give me your e-mail in case you want to use my font files.

这篇关于API等级15的北印度语字体(aka Android 4.0.2)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆