GithubHelp home page GithubHelp logo

simonsmh / notocjk Goto Github PK

View Code? Open in Web Editor NEW
452.0 8.0 21.0 784.89 MB

NotoSansCJK & NotoSerifCJK full weight patch for Android devices.

License: SIL Open Font License 1.1

Shell 100.00%
magisk magisk-module fonts

notocjk's Introduction

NotoCJK

Upload zip Download

NotoSansCJK & NotoSerifCJK full weight patch for Android devices.

  • NotoSansCJK VF support as full weight patch applies to Android O+
  • NotoSerifCJK full weight patch applies to Android P+

Fonts are provided by Google.

Maintenance

Currently, this module is still maintained. It was used to be stored at official repo but got removed in repo cleanup. Now you can download it directly in this repo's release tabs.

John Wu's Twitter for details

NOTICE

  • You should use latest Magisk Manager to install this module. If you meet any problem under installation from Magisk Manager, please try to install it from recovery.

  • New features:

Upgrade Noto Serif CJK to 2.000(R) that supports variable fonts.

Noto Serif CJK variable test

  • Recent fixes:

Support system_ext #40

  • Known issues:

HK fonts style is pending & waiting for Google solution in later android versions.

Font weight in Firefox is not current (all be thin) if force it to use Noto Sans CJK VF. (#28)

Android 12 may crash in some app after installed version 10 and above with Magisk Hide enabled. See: (Chinese only, more details of logs in comments) https://t.me/magiskalpha/297

Credit & Support

  • Copyright (C) 2017-2022 simonsmh [email protected]
  • Any issue or pull request is welcomed.
  • Star this module at GitHub.

notocjk's People

Contributors

123duo3 avatar aviraxp avatar simonsmh avatar topjohnwu avatar wordlessecho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

notocjk's Issues

MIUI EU 套用失敗

已經把customize.sh的註釋解開了,但是沒有完全移除乾淨Misans在fonts.xml的訊息
以下這段沒有被移除掉,我猜測可能是因此沒有套用成功
***
***Miui-Regular.ttf
***
***
***Miui-Regular.ttf
***
系統原始版.txt
不完全修改版.txt

版本:
MIUI EU 13.0.13穩定版

(建议)Regular字重不使用可变字体(使用自带的NotoCJK文件)

将字重400的NotoCJK由可变字体版本更换为安卓自带的NotoCJK-Regular.ttc后可以在不增加模块大小的情况下解决部分兼容性问题,如图
Screenshot_20220116-215435_Firefox
Screenshot_20220116-213616_Firefox
例如:
原costomize.sh的Regular字重写法:
NotoSansCJK-VF.otf.ttc<axis tag="wght" stylevalue="400" /></font>\n
更改后(参考了谷歌在安卓12中对Roboto VF的调用)
NotoSansCJK-Regular.ttc</font>\n

仅需要更改Regular字重,其他不改变
参考了Google对Roboto VF的处理(如下图)
Screenshot_20220116-223803_Root Explorer

一加修改 font.xml 修改到注释里 导致中文部分不生效

fonts_xml.zip
被加到这里了

    <!-- [email protected], 2019-05-13 : Modified for SysSans fonts-->
    <!--
    <family lang="zh-Hans">
        <font weight="400" style="normal" index="2">NotoSansCJKjp-Regular.otc</font>
        <font weight="400" style="normal" index="2" fallbackFor="serif">NotoSerifCJKjp-Regular.otc</font>
    </family>
    <family lang="zh-Hant,zh-Bopo">
        <font weight="400" style="normal" index="3">NotoSansCJKjp-Regular.otc</font>
        <font weight="400" style="normal" index="3" fallbackFor="serif">NotoSerifCJKjp-Regular.otc</font>
    </family>
    --> <!--  #else /* OPLUS_FEATURE_FONT_FLIP */-->

一加 coloros 12 适配

字体如果需要在一加的 coloros 12 中全局生效,配置文件需要放在 /system/system_ext/etc/fonts_base.xml;我试图在 customize.sh 中把 sed 之后的文件 copy 到该位置,但是还是没有生效。我对 magisk 模块并不是很了解,只好求助 maintainer 啦!多谢!

刷入模块时报错

image

Android版本:12.1
fonts_customization.xml

<?xml version="1.0" encoding="utf-8"?>
<fonts-modification version="1">
    <family customizationType="new-named-family" name="lato">
        <font weight="400" style="normal">Lato-Regular.ttf</font>
        <font weight="400" style="italic">Lato-Italic.ttf</font>
        <font weight="500" style="normal">Lato-Medium.ttf</font>
        <font weight="500" style="italic">Lato-MediumItalic.ttf</font>
        <font weight="700" style="normal">Lato-Bold.ttf</font>
        <font weight="700" style="italic">Lato-BoldItalic.ttf</font>
    </family>
    <alias name="lato-medium" to="lato" weight="500" />
    <alias name="lato-bold" to="lato" weight="700" />

    <family customizationType="new-named-family" name="rubik">
        <font weight="400" style="normal">Rubik-Regular.ttf</font>
        <font weight="400" style="italic">Rubik-Italic.ttf</font>
        <font weight="500" style="normal">Rubik-Medium.ttf</font>
        <font weight="500" style="italic">Rubik-MediumItalic.ttf</font>
        <font weight="700" style="normal">Rubik-Bold.ttf</font>
        <font weight="700" style="italic">Rubik-BoldItalic.ttf</font>
    </family>
    <alias name="rubik-medium" to="rubik" weight="500" />
    <alias name="rubik-bold" to="rubik" weight="700" />
</fonts-modification>

在Apatch上引起了一些崩溃

Lineage OS 20, Apatch 10568
开机动画消失,导航栏锁定在三按钮模式无法切换其他,一些应用停止运行。
无法确定是哪边的问题。当然Apatch还在早期阶段,等它稳定一些了再适配也不迟。

请教关于修改 index 无用的问题

我把 fonts.xml 中的 "zh-Hant" "zh-Hant zh-Bopo" 下的 index 修改为 1("ko"),但是似乎刷入后没有此效果(和修改 index 前的效果一样,繁体中文下未使用韩国字形)。
请问这是什么原因呢?
Redmi Note 8 Pro
MIUI Global 11.0.3
Android 9

Installation failed in Magisk v16.0

When install this module in Magisk manager with Magisk v16.0, it failed with a notice that "Please install Magisk v15.0+". And when install it in recovery mode, it failed with an error code 1.

[Feature Request / RFC] 配合 FontManagerService 将字体文件安装到 data 分区

背景

/proc/self/maps 中会显示通过 mmap 映射的文件名和对应的设备号,通过 VFS 机制(Magisk 的 bind mount 或 KernelSU 的 overlayfs)修改的字体文件会显示 data 分区的设备号,从而触发部分应用的风控策略。

TB320FC:/ # grep ' /system/' /proc/$(pidof com.android.systemui)/maps
...
707b39d000-707b39e000 r--p 00000000 fe:09 3813                           /system/lib64/libasyncio.so
707b39e000-707b39f000 r-xp 00001000 fe:09 3813                           /system/lib64/libasyncio.so
707b39f000-707b3a0000 r--p 00002000 fe:09 3813                           /system/lib64/libasyncio.so
707b3d2000-707b3e2000 r--p 00000000 fe:09 4097                           /system/lib64/libmediadrmmetrics_full.so
707b3e2000-707b3f4000 r-xp 00010000 fe:09 4097                           /system/lib64/libmediadrmmetrics_full.so
707b3f4000-707b3f6000 r--p 00022000 fe:09 4097                           /system/lib64/libmediadrmmetrics_full.so
707b3f6000-707b3f7000 rw-p 00023000 fe:09 4097                           /system/lib64/libmediadrmmetrics_full.so
707f05e000-708096d000 r--p 00000000 fe:0f 89819                          /system/fonts/NotoSerifCJK-Regular.ttc
708096d000-7081c00000 r--p 00000000 fe:0f 49003                          /system/fonts/NotoSansCJK-Regular.ttc
7081c00000-7085231000 r--p 00000000 fe:0f 89876                          /system/fonts/NotoSerifCJK-VF.otf.ttc
7085231000-708715d000 r--p 00000000 fe:0f 88918                          /system/fonts/NotoSansCJK-VF.otf.ttc
708715d000-70873a1000 r--p 00000000 fe:09 2730                           /system/fonts/Roboto-Regular.ttf
708aa58000-708aab3000 r--p 00000000 fe:09 3940                           /system/lib64/libcrypto.so
708aab3000-708ab2a000 r-xp 0005b000 fe:09 3940                           /system/lib64/libcrypto.so
708ab2a000-708ab7b000 --xp 000d2000 fe:09 3940                           /system/lib64/libcrypto.so
708ab7b000-708ab80000 r-xp 00123000 fe:09 3940                           /system/lib64/libcrypto.so
708ab80000-708ab90000 r--p 00128000 fe:09 3940                           /system/lib64/libcrypto.so
708ab90000-708ab91000 rw-p 00137000 fe:09 3940                           /system/lib64/libcrypto.so
...

要消除此类痕迹,需要 VFS 路径与对应设备号匹配(即路径显示 /data/xxxxxx),或将对应地址替换为 memfd 映射(Shamiko)。

PoC

Android 12 提供了通过 OTA 单独更新字体文件的方法:https://source.android.com/docs/core/fonts/custom-font-fallback

字体文件受 fs-verity 以及签名验证保护(Android 12-13 为 fs-verity 签名验证,Android 14 为用户态签名验证),FontManagerService 启动时会删除 /data/fonts 下验证失败的文件。

  • Android 12-13 需要禁用 fs-verity 签名验证:echo 0 > /proc/sys/fs/verity/require_signatures
  • Android 14 需要使用 RRO 向 config_fontManagerServiceCerts 追加自签名证书

以下步骤是以 Android 13 为例。

# # 安装字体
# echo 0 > /proc/sys/fs/verity/require_signatures
# touch /data/local/tmp/dummy
# # 由于禁用了签名验证,可以使用空文件作为签名文件
# # 此处两个路径都需要 system_server 进程可读
# cmd font update /system/fonts/NotoSansCJK-VF.otf.ttc /data/local/tmp/dummy
Success
#
# # 修改模块
# echo "echo 0 > /proc/sys/fs/verity/require_signatures" >> /data/adb/modules/notocjk/post-fs-data.sh
# rm /data/adb/modules/notocjk/system/fonts/NotoSansCJK-VF.otf.ttc
#
# # 重启验证
# reboot
# grep fonts /proc/$(pidof com.android.systemui)/maps
72cf22b000-72d1157000 r--p 00000000 fe:0f 97458                          /data/fonts/files/~~xbiOPHgakY7ty1i3IeKxog==/NotoSansCJKjp-Thin.otc
735a8aa000-735c1b9000 r--p 00000000 fe:0f 95862                          /system/fonts/NotoSerifCJK-Regular.ttc
735c1b9000-735d44c000 r--p 00000000 fe:0f 95828                          /system/fonts/NotoSansCJK-Regular.ttc
735d44c000-7360a7d000 r--p 00000000 fe:0f 95836                          /system/fonts/NotoSerifCJK-VF.otf.ttc
7360a7d000-7360cc1000 r--p 00000000 fe:09 2730                           /system/fonts/Roboto-Regular.ttf
7696ce8000-7696d33000 r--p 00000000 fe:09 2731                           /system/fonts/RobotoStatic-Regular.ttf

其他信息

  • FontManagerService 只能更新字体文件以及 named family,fallback family 依然需要通过修改 fonts.xml 实现
  • fonts.xml 中需要引用正确的 PostScript name
  • 需要更高的 fontRevision 才能覆盖 /system/fonts 下相同 PostScript name 的字体
    • PostScript name 和 fontRevision 相同时,会优先使用 /system/fonts 中的字体文件
    • 或许可以 patch 一下 fontRevision?
  • 用户可以通过 cmd font clear 主动删除所有热更新字体

安装失败

使用的是 Releases 下的模块。

  • Redmi Note 7 Pro
  • Android 10
  • Magisk 20.4

DemiLight的可调用性

在API28以下的系统中,TextView调用不同字重的字体所使用的属性是fontFamilyfontFamily的属性值则使用了fonts.xml中的alias

在系统默认的alias中,是没有DemiLight的。也就是说,不使用API28以后提供的textFontWeight,DemiLight实际上是无法被程序调用的。

问题:

  1. 应不应当为Noto Sans CJK加入DemiLight的alias?
  2. fallbackFor属性与textFontWeight是同期推出的,Noto Serif CJK是不是没有必要再添加alias(视作为历史遗留)?

Android12的MIUI13

部分符号上浮,浏览器内的符号无法显示,例如423down网页内的搜索🔍图标显示为框

MIUI10不能设置为全局字体

安装了模块,但是只有部分应用字体是Noto Sans CJK,而系统(及其自带应用)自带的字体依然是小米兰亭。
我安装的版本:
image
image
知乎显示正常:
image

美团外卖显示正常:
image

系统和系统应用的界面,显示的是小米兰亭:
image
image
image
image

锁屏界面还是小米兰亭:
image

锁屏输入密码这里是Noto Sans CJK:
image

微信显示则是两种字体混用:
image
image

PS:状态栏显示的也是小米兰亭

希望能够推出只包含400和700字重的nano版本

我现在的手机是小米MIX2,装了这个字体模块之后,打开微信、知乎、哔哩哔哩都会卡半天打不开。一开始,我以为是Magisk有什么bug,导致的卡顿。所以,我就自己手动把字体和fonts.xml复制到/system分区,然后,发现还是卡顿。然后,也换过字体格式,什么SuperOTC、中日韩单独的OTF都试过一遍,还是会卡。当然,单独的OTF文件会有所缓解,但还是无法忍受。那我只能降低点要求,减少字体规模,把最常用的400和700字重的字体留下,分别对应Regular和Bold,其他的字重舍去。试了一下发现基本不卡了,粗体也能正常显示了。不知道作者方不方便制作这个nano版本?

安装失败求助

手机:OnePlus 7T pro
系统:Android 10
Magisk 版本:20.4

安装流程:
因 magisk 仓库中搜不到对应的模块,我下载源码打包成 zip 然后安装

报错:

- Copying zip to temp directory
- Installing notocjk.zip
! Installation failed

Oxygen OS 11 存在两个字体的配置文件

设备:一加8T
系统版本:OP8T_O2_BETA_2 Android 11
发现 Oxygen OS 11上(10以下不清楚)存在 font.xml 和font_base.xml两个配置文件, font_base.xml 和 AOSP 上的 font.xml 一样, font.xml 是在开头加了一加自己的字体。
单独修改 font.xml 不能够完全的补充字重, font_base.xml 也需要修改才能够让所有应用显示出缺少的字重。
Screenshot_20210411-133517

Google Play Store crashes with the module enabled

Device: Pixel 7
OS Version: Android 14
Build number: AP1A.240405.002
Play Store Version: 40.4.31-31 [0] [PR] 621249419


Play Store will open normally with the module enabled, but right after the loading animation (that's when data and UI are rendered) the Play Store crashes. After I disabled the module and rebooted, the Play Store would open normally.

My Google Account is in Japan, so my Play Store homepage would be filled with Japanese, which might be related.

fonts.xml 错误,NotoSerifCJK 与 NotoSansCJK 字重并非完全对应

脚本生成的 fonts.xml 根本不对,NotoSerifCJK 与 NotoSansCJK 字重并非完全对应。NotoSerif
拥有 semibold,extralight,但却没有 demilight, thin 字重。NotoSansCJK 拥有 Demilight, thin 却没有 Semibold, extralight.

以下是目前脚本生成的字体配置,

    <family lang="zh-Hans">
        <font weight="100" style="normal" index="2">NotoSansCJK-Thin.ttc</font>
        <font weight="100" style="normal" index="2" fallbackFor="georgia">NotoSerifCJK-Thin.ttc</font>
        <font weight="300" style="normal" index="2">NotoSansCJK-Light.ttc</font>
        <font weight="300" style="normal" index="2" fallbackFor="georgia">NotoSerifCJK-Light.ttc</font>
        <font weight="350" style="normal" index="2">NotoSansCJK-DemiLight.ttc</font>
        <font weight="350" style="normal" index="2" fallbackFor="georgia">NotoSerifCJK-DemiLight.ttc</font>
        <font weight="400" style="normal" index="2">NotoSansCJK-Regular.ttc</font>
        <font weight="400" style="normal" index="2" fallbackFor="georgia">NotoSerifCJK-Regular.ttc</font>
        <font weight="500" style="normal" index="2">NotoSansCJK-Medium.ttc</font>
        <font weight="500" style="normal" index="2" fallbackFor="georgia">NotoSerifCJK-Medium.ttc</font>
        <font weight="900" style="normal" index="2">NotoSansCJK-Black.ttc</font>
        <font weight="900" style="normal" index="2" fallbackFor="georgia">NotoSerifCJK-Black.ttc</font>
        <font weight="700" style="normal" index="2">NotoSansCJK-Bold.ttc</font>
        <font weight="700" style="normal" index="2" fallbackFor="georgia">NotoSerifCJK-Bold.ttc</font>
    </family>

[REMINDER] Update to the new module installer!

Just in case if you are not aware, a completely new Magisk Module Installer replaces the old Magisk module template. This new format decouples ALL installation logic from modules, and encourages developers to use the provided API for installation. This new format is ENFORCED, meaning all existing modules should upgrade ASAP, and new modules are REQUIRED to follow the rules.

Carefully read through the updated docs!

Warning: All existing modules that does not use the new module format will be automatically removed on May 1st, 2019. Module devs: upgrade your existing modules ASAP!

P.S. This issue is just a kind reminder, you can close it after reading this message :)

Support `postScriptName` on Android 12

<font weight="400" style="normal" index="2" postScriptName="NotoSansCJKjp-Regular">

fonts.xml line 1300

6: PostScript name for the font; Name ID 6 specifies a string which is used to invoke a PostScript language font that corresponds to this OpenType font. When translated to ASCII, the name string must be no longer than 63 characters and restricted to the printable ASCII subset, codes 33 to 126, except for the 10 characters '[', ']', '(', ')', '{', '}', '<', '>', '/', '%'.

In a CFF OpenType font, there is no requirement that this name be the same as the font name in the CFF’s Name INDEX. Thus, the same CFF may be shared among multiple font components in a Font Collection. See the 'name' table section of “Recommendations for OpenType fonts” for additional information.

name - Naming table (OpenType 1.8.4) - Typography

Android 9.0 installation issue

你好,simonsmh
很感谢你持续更新magisk的notocjk包,一直从android 6.x 使用到现在的 android 9.x。
之前记得在 android 7.0的时候提过一个issue就是关于DroidSansFallback.ttf导致 aldiko乱码的,你耐心回答并在后续更新包中采用了我提供的DroidSansFallback字体。
最近,手机系统升级到了android 9.0 刷 magisk-notocjk 包 DroidSansFallback.ttf 未生效,电子书 Aldiko 再次出现乱码。
再次来麻烦simonsmh兄,希望能有空的时候解决一下这个问题,谢谢

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.