2

Androidでのバングラのコードは次のとおりです。

package com.exam;

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

public class TextDifferentActivity extends Activity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        Typeface tf = Typeface.createFromAsset(getAssets(),
                "fonts/DroidSansFallback.ttf");
        TextView tv = (TextView) findViewById(R.id.CustomFontText);
        tv.setTypeface(tf);
    }
}

XML コード

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
    android:id="@+id/DefaultFontText"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="30sp"
    android:text="Here is some text." />
<TextView
    android:id="@+id/CustomFontText"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textSize="30sp"
    android:text="আল্লাহ">
    </TextView>
</LinearLayout>

ここではআ্ললাহ।と表示されていますが、আল্লাহと表示する必要があります。どうすれば問題を解決できますか? 私の電話、HTC A3333では、フォントが表示されます。それを正しくするための他の解決策はありますか?

4

1 に答える 1

2

何をしても、複雑なグリフ (juktoborno) は常に壊れた文字として表示されます。私が見つけた唯一の解決策は、それらに画像を使用することです。この目的にはSpannableStringBuilderを使用できます。ただし、以下に示すように、画像はフォントの文字と完全に同期しないため、juktoborno のみに画像を 使用するのは完全ではありません。ここに画像の説明を入力

したがって、すべての文字を画像に置き換える必要があるため、必要な画像の数がかなり多くなります。ただし、オーバーレイ技術を使用して大幅に削減できる画像はありません。これは私が最終的に達成したものです: ここに画像の説明を入力

于 2012-05-07T20:27:29.463 に答える