gpt4 book ai didi

android - 如何解决 Android 中 Bangla 字体中的 jukto(connected) 单词?

转载 作者:行者123 更新时间:2023-11-29 00:40:33 28 4
gpt4 key购买 nike

这是我的 Bangla 代码在安卓中:

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 , 它显示字体。是否有任何其他解决方案可以使其正确?

最佳答案

无论你做什么复杂的字形 (juktoborno) 总是显示为损坏的字符,我找到的唯一解决方案是为它们使用图像。为此,您可以使用 SpannableStringBuilder。但仅将图像用于 juktoborno 并不完美,因为图像与字体字符无法完美同步,如下所示: enter image description here

所以你需要用图像替换所有字符,这使得所需图像的数量非常高。但是使用Overlay 技术并不能大大减少图像。这是我最终实现的: enter image description here

关于android - 如何解决 Android 中 Bangla 字体中的 jukto(connected) 单词?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9654400/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com