Text with “f” following “i”, cannot see the dot on

2019-02-24 03:15发布

I have a Button in which there is the text "Send files", but I cant see the dot on the top of the "i". I am using the default font (which is "sans", as far as I understand, but correct me if I am wrong).

Here is the xml for my Button :

            <Button
                android:id="@+id/button_send_files"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_marginBottom="5dip"
                android:padding="20dip"
                android:text="Send files"
                android:textColor="@color/black"
                android:textSize="24sp"
                android:textStyle="bold" />

If someone has some sort of trick to display the dot on the "i", it would be grea, because it's ugly as it is for now...

I am using a Nexus 7, if it can help.

enter image description here

5条回答
等我变得足够好
2楼-- · 2019-02-24 03:49

Changing the font is the only viable solution at the moment. Ligature glyphs aren't handled well for Roboto-Regular. Try changing the font to sans. Its not elegant, but it works.

查看更多
Animai°情兽
3楼-- · 2019-02-24 04:00

To disable ligatures, you can use the android:fontFeatureSettings attribute on your TextView. This attribute accepts valid values for the CSS property font-feature-settings. Here's a list of examples from the MDN. They give an example of disabling ligatures there.

Here's how you'd use it on an TextView (I've verified this works):

android:fontFeatureSettings="liga 0"

You can also do this in styles.xml:

<style name="your_text_style">
    <item name="android:fontFeatureSettings">liga 0</item>
</style>
查看更多
Bombasti
4楼-- · 2019-02-24 04:02

I know this post is old but it's the top result when you google "disable ligatures on android". Apparently there's a way to do it, but it only works API 21 and newer. So here's my solution. Download the free font editing program FontForge, remove the ligature glyphs from the actual font (fi and fl), and resave the font file. Works like a charm!

查看更多
Emotional °昔
5楼-- · 2019-02-24 04:06

What you are seeing is a ligature glyph for the combination of 'f' + 'i' characters. Frequently, the combination of the standalone 'f' + standalone 'i' will end up in conflict: the overhanging portion of the 'f' will collide with the dot of the 'i'.

The use of a ligature glyph to represent the combination of characters allows a font designer to avoid a collision. In this case, the font designer opted to omit the dot of the 'i'. In other font designs, the dot of the 'i' will stay but the length of the overhanging portion of the 'f' will change so as to avoid a collision. If you examine some other font designs that include a ligature for 'f' + 'i' you will see these different visual treatments. As this is a font design decision, it's difficult to characterize this as a "mistake"; more like "bad design" (I agree with you that it does not look very good).

查看更多
疯言疯语
6楼-- · 2019-02-24 04:06
登录 后发表回答