Android中添加思源字体/NotoSansCJK/SourceHanSans

本文介绍了在Android 4.2.2中添加思源字体Noto Sans CJK的详细过程,包括获取字体文件、选择常规和加粗体、将字体放入/system/fonts/目录,以及更新vendor/etc/fallback_fonts.xml配置。通过此操作,低分辨率屏幕上的文字显示将变得更加清晰。
摘要由CSDN通过智能技术生成
               

系统版本:Android 4.2.2_r1

本文主要是在Android中添加思源字体的过程记录。思源字体是Google和Adobe在2014.07.18发布的中文字体。

1.获取思源字体(Google:Noto Sans CJK; Adobe:Source Han Sans)。

2.解压后如下几个才是思源字体。

  •  NotoSansHans-Regular.otf    常规
  •  NotoSansHans-Black.otf      黑体
  •  NotoSansHans-DemiLight.otf  
  •  NotoSansHans-Medium.otf 
  •  NotoSansHans-Thin.otf 
  •  NotoSansHans-Bold.otf        加粗
  •  NotoSansHans-Light.otf

注:这里说下otf,意为opentype和ttf(truetype)是兼容的。

3.安装体验

由于Android中只使用到常规和加粗体,这里也只以这两个做实验(同时也有容量的考虑),在高PPI(分辨率)的屏幕上或许只是感觉到字形变了,在低分辨率的屏幕上变的更加清晰了,前后对比:

之前:


之后:


(上传到这里就不清晰了,真是怪,点击链接看原图更为清晰)

  1) 将NotoSansHans-Regular.otf NotoSansHans-Bold.otf放到/system/fonts/目录下。

  2) 将如下fallback_fonts.xml放到/vendor/etc/下。

<?xml version="1.0" encoding="utf-8"?>

<!--

    Vendor-provided fallback fonts

 

    This file can be edited to add references to fonts that are not installed or referenced in the

    default system. The file should then be placed in /vendor/etc/fallback_fonts.xml. Note

    that in your makefile, this directory should be referenced as $(TARGET_COPY_OUT_VENDOR)/etc/:

 

        PRODUCT_COPY_FILES += \

            frameworks/base/data/fonts/vendor_fonts.xml:$(TARGET_COPY_OUT_VENDOR)/etc/fallback_fonts.xml

 

    For example, vendors might want to build configurations for locales that are

    better served by fonts which either handle glyphs not supported in the default fonts or which

    handle these glyphs differently than the default fallback fonts.

    Each entry in this list is a "fa

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值