使用阿拉伯语或波斯语字体时,TextView 和 WebView 中的英文文本存在问题,下图是使用默认字体时 TextView(标题中的 2 个视图)和 WebView(底部)中的波斯语和英语文本的示例字体:镜头 1
但是当应用自定义字体时,它看起来像这样(此处应用伊朗无衬线字体,但几乎所有波斯字体都有相同的问题):Shot 2
如您所见,在带有波斯语字体的 TextView 中,英文文本未正确对齐,并且在 WebView 中,由于波斯语文本大小和英文文本大小之间的差异,某些行之间存在额外的填充。
确保字体没有问题,因为在网站中,它们的工作就像一个魅力!
<resources>
<style name="TextViewFont" parent="Theme.AppCompat">
<item name="fontFamily">@font/sogand</item>
</style>
<TextView
style="@style/TextViewFont"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="12dp"
android:shadowColor="@color/black"
android:shadowDx="5"
android:shadowDy="5"
android:shadowRadius="5"
android:text="@string/mahyar_school"
android:textColor="@color/white"
android:textSize="18sp" />