I have to think about it. Basically Carbon was intended to work on Android 2.2 which is main target of my other app. Android 2.2 doesn't have Roboto, so I need it. But, I'm aware of that Roboto is present on newer systems. Maybe providing Roboto as an opt-in package would be good. The other option is to remove these files with Proguard.
exclude roboto font
carbon is a very cool lib materialized my app with almost no extra work. but it has a side-effect that roboto fonts which i don't use in my language inceased the size of apk by 2mb. I was wondering if there's a way to remove roboto fonts from carbon lib?
- 点赞 评论 复制链接分享
I tried with proguard setting minifyEnabled to true but it doesn't seems to help. also with shrinkResources true点赞 评论 复制链接分享
This issue was raised before with no real solution except cloning the repo and removing fonts manually. See: https://github.com/ZieIony/Carbon/issues/154
I have to check if it's safe to remove fonts. Ideally removing fonts on ICS and above should work fine.点赞 评论 复制链接分享
Let's keep this issue open until we find a better solution.点赞 评论 复制链接分享
What if just completely remove the fonts from library package? Roboto font is free for downloading from Material Design guidelines site so anyone can get particular typefaces from the whole font archive and use them. Am I wrong?点赞 评论 复制链接分享
You're right, but: 1. Fonts have to be in assets/fonts and have correct names. I'm sure that someone will forget about that and report not working fonts as a bug. Or will ask where he/she can find these fonts. I would like to have a more straightforward solution. 2. I'm not sure what happens when you just delete fonts. Probably it won't work on newer Androids because there's no code for using system fonts if present. 3. It's not as important as 1 and 2, but Roboto was updated recently, so only Lollipop and Marshmallow have the correct version. See: https://www.google.com/fonts/specimen/Roboto点赞 评论 复制链接分享
点赞 评论 复制链接分享
- I thought that using custom fonts from assets folder is a common task and Carbon just makes it easier. I mean using fonts from assets folder of app itself and not library's.
- Custom fonts can be used on any Android OS, so it seems to be a good solution for me.
Carbon contains these fonts, because carbon_Theme makes heavy use of them. I just wanted to have Roboto on all platforms and all views by default. That's why I need a specific set of correct files.
Probably the best approach would be to extend android:fontFamily and android:textStyle to be translated to Roboto on all platforms (Roboto Thin working pre 4.2, etc.). The assets folder with all fonts can be moved to a different place, so users can download it right from Carbon's repository when needed. The carbon_fontPath attribute can stay as it is now.点赞 评论 复制链接分享
Done. Now to get all fonts on all platforms you have to download .ttf files to your project. See samples.点赞 评论 复制链接分享
- SpringBootApplication注解 exclude 失效
- Golang解释gdb SIGILL，非法指令
- 在foreach中排除空类别名称（$ category作为$ category）
- 在Woocommerce 3+上通过PHP更改产品可见性
- 从列表中排除类别 - Wordpress
- eclipse 设置buildpath的问题，报错如下
- IDEA 里文件的mark directory as选项里面只有Excluded