androidttf 字体库生成库文件ttf是怎么生成的

安卓系统文件、文件夹作用,可删除应用及修改字体的方法_安卓后院
安卓系统文件、文件夹作用,可删除应用及修改字体的方法
上次见到有人发布了安卓手机SD卡文件夹详细列表,感觉挺好的,但是SD卡毕竟不是系统,值得研究的地方较少,这次就带你走进安卓系统世界. &首先简单介绍一下安卓系统文件夹对照表 & 主要介绍的是Android手机系统的文件夹结构,帮助大家更直观地了解系统 &
\system\app这个里面主要存放的是常规下载的应用程序,可以看到都是以APK格式结尾的文件。在这个文件夹下的程序为系统默认的组件,自己安装的软件将不会出现在这里,而是
\data\文件夹中。 &下面是详细的介绍: &
\system\bin这个目录下的文件都是系统的本地程序,从bin文件夹名称可以看出是binary二进制的程序,里面主要是Linux系统自带的组件,Android手机网就主要文件做下简单的分析介绍: &
\system\bin\akmd \system\bin\am &
\system\bin\app_process 系统进程&
\system\bin\dalvikvm Dalvik 虚拟机宿主 &
\system\bin\dbus-daemon 系统BUS总线监控&
\system\bin\debuggerd 调试器 &
\system\bin\debug_tool 调试工具&
\system\bin\dexopt DEX选项 &
\system\bin\dhcpcd DHCP服务器&
\system\bin\dumpstate 状态抓取器 &
\system\bin\dumpsys 系统抓取器&
\system\bin\dvz &
\system\bin\fillup \system\bin\flash_image 闪存映像 &
\system\bin\hciattach \system\bin\hcid HCID内核 &
\system\bin\hostapd \system\bin\hostapd_cli &
\system\bin\htclogkernel \system\bin\input &
\system\bin\installd \system\bin\itr &
\system\bin\linker \system\bin\logcat Logcat日志打印 &
\system\bin\logwrapper \system\bin\mediaserver &
\system\bin\monkey \system\bin\mountd 存储挂载器 &
\system\bin etcfg 网络设置 &
\system\bin\ping Ping程序&
\system\bin\playmp3 MP3播放器 &
\system\bin\pm 包管理器&
\system\bin\qemud QEMU虚拟机 &
\system\bin\radiooptions 无线选项&
\system\bin\rild RIL组件 &
\system\bin\sdptool \system\bin\sdutil &
\system\bin\service \system\bin\servicemanager 服务管理器 &
\system\bin\sh \system\bin\ssltest SSL测试 &
\system\bin\su**ceflinger触摸感应驱动&
\system\bin\svc 服务 &
\system\bin \system_server &
\system\bin\telnetd Telnet组件&
\system\bin\toolbox &
\system\bin\wlan_loader \system\bin\wpa_cli &
全国注册建筑师、建造师考试
备考资料 历年真题 考试心得 模拟试题
\system\bin\wpa_supplicant &
\system\etc从文件夹名称来看保存的都是系统的配置文件,比如APN接入点设置等核心配置。&
\system\etc\apns-conf.xml APN接入点配置文件&
\system\etc\AudioFilter.csv 音频过滤器配置文件 &
\system\etc\AudioPara4.csv \system\etc\bookmarks.xml 书签数据库 &
\system\etc\dbus.conf 总线监视配置文件&
\system\etc\dhcpcd &
\system\etc\event-log-tags \system\etc\favorites.xml 收藏夹 &
\system\etc\firmware 固件信息&
\system\etc\gps.conf GPS设置文件 &
\system\etc\hcid.conf* 内核HCID配置文件&
\system\etc\hosts 网络DNS缓存 &
\system\etc\init.goldfish.sh \system\etc\location 定位相关 &
\system\etc\mountd.conf 存储挂载配置文件&
\system\etc\NOTICE.html 提示网页 &
\system\etc\permissions.xml 权限许可&
\system\etc\pvplayer.conf &
\system\etc\security \system\etc\wifi WLAN相关组件 &
\system\etc\dhcpcd\dhcpcd-hooks \system\etc\dhcpcd\dhcpcd-run-hooks &
\system\etc\dhcpcd\dhcpcd.conf \system\etc\dhcpcd\dhcpcd-hooks\01-test &
\system\etc\dhcpcd\dhcpcd-hooks\20-dns.conf&
\system\etc\dhcpcd\dhcpcd-hooks\95-configured &
\system\etc\firmware\brf6300.bin \system\etc\location\gps &
\system\etc\location\gps\location 定位相关&
\system\etc\location\gps &mea GPS数据解析&
\system\etc\location\gps\properties &
\system\etc\security\cacerts.bks \system\etc\security\otacerts.zip OTA下载验证 &
\system\etc\wifi\Fw1251r1c.bin \system\etc\wifi\tiwlan.ini &
\system\etc\wifi\wpa_supplicant.conf WPA验证组件 &
\system\fonts字体文件夹,除了标准字体和粗体、斜体外可以看到文件体积最大的可能是中文字库,或一些un icode字库,从T-Mobile G1上可以清楚的看到显示简体中文正常,其中 :DroidSansFallback.ttf文件大小&
\system\fonts\DroidSans-Bold.ttf &
\system\fonts\DroidSans.ttf \system\fonts\DroidSansFallback.ttf &
\system\fonts\DroidSansMono.ttf \system\fonts\DroidSerif-Bold.ttf &
\system\fonts\DroidSerif-BoldItalic.ttf \system\fonts\DroidSerif-Italic.ttf &
\system\fonts\DroidSerif-Regular.ttf &
\system\frameworkframework 主要是一些核心的文件,从后缀名为jar可以看出是是系统平台框架。 &
\system\framework\am.jar \ system\framework\am.odex &
\system\framework\android.awt.jar AWT库&
\system\framework\android.awt.odex &
\system\framework\android.policy.jar \system\framework\android.policy.odex &
\system\framework\android.test.runner.jar \system\framework\android.test.runner.odex &
\system\framework\com.google.android.gtalkservice.jar GTalk服务 &
\system\framework\com.google.android.gtalkservice.odex &
\system\framework\com.google.android.maps.jar 电子地图库 &
\system\framework\com.google.android.maps.odex &
\system\framework\core.jar & 核心库,启动桌面时首先加载这个 &
\system\framework\core.odex \system\framework\ext.jar &
\system\framework\ext.odex \system\framework\framework-res.apk &
\system\framework\framework-tests.jar \system\framework\framework-tests.odex &
\system\framework\framework.jar \system\framework\framework.odex &
\system\framework\input.jar 输入库&
\system\framework\input.odex &
\system\framework\itr.jar \system\framework\itr.odex &
\system\framework\monkey.jar \system\framework\monkey.odex &
\system\framework\pm.jar 包管理库&
\system\framework\pm.odex &
\system\framework\services.jar \system\framework\services.odex &
\system\framework\ssltest.jar \system\framework\ssltest.odex &
\system\framework\svc.jar系统服务 &
&一: 修改权限方法 & root管理器 先把上头的挂载读、写点一下 使前面显示为读写 而不是只读 &然后长按你要修改的文件 选择权限 &然后就可以打钩了 &&
二:程序精简 &许多机油喜欢精简程序什么的,所以附上安卓内置APK程序中英文对照表 ,由于机型不一定相同,所以仅供参考 想删除系统自带的软件,首先需要root,完成后安装RE管理器,系统自带文件放在system/app下,对照下表,选择删除即可。 &
序号 不可以删除(15项) &&
1 AccountAndSyncSettings.apk 同步与帐户设定 不可以删除 &
2 ApplicationsProvider.apk 应用程序支持服务 不可以删除 &
3 CertInstaller.apk 证书服务 不可以删除 &&
4 ContactsProvider.apk 通讯录/联系人数据存储服务 不可以删除 &
5 DefaultContainerService.apk 默认通讯录服务 不可以删除 &
6 DownloadProvider.apk 下载管理器 不可以删除 &
7 DrmProvider.apk DRM 受保护数据存储服务 不可以删除 &
8 googlevoice.apk 这个是电话和短信功能 不可以删除 &
9 MediaProvider.apk 媒体数据存储服务 不可以删除 &
10 MtkBt.apk 全球卫星定位系统接收器 不可以删除 &
11 PackageInstaller.apk 程序安装 不可以删除 &
12 Phone.apk 电话拨号程序 不可以删除 &
13 Settings.apk 系统设置 不可以删除 &&
14 SettingsProvider.apk 设置服务程序 不可以删除 &&
15 TelephonyProvider.apk 拨号记录存储服务 不可以删除 &
序号 建议保留(23项) &&
1 AcwfDialog.APK &
&2 apkCompassCH.apk 超级指南针(建议保留) &&
3 Bluetooth.apk 蓝牙(删了就没有蓝牙了)建议保留 &&
4 Calculator.apk 计算器(自带计算器较弱,可用其他替代) &
5 Camera.apk 自带相机(用360的可删) &&
6 Contacts.apk 通讯录/联系人(用第三方通讯录的可删) &
7 DataDialog.apk 数据对话框 不确定,没删 &
8 DeskClock.apk 自带闹钟(用第三方闹钟的可删) &
9 EngineerMode.apk 工程师模式 不确定,没删 &
10 ES_filemanager.apk 资源浏览器(建议保留) &
11 fmradio.apk 收音机(可删) &&
12 Gallery3D.apk 相机相框 (可删) &&
13 GoLauncher.apk 桌面 &&
14 Mms.apk 自带信息(可删,用第三方短信的就删了吧,提示:删了后,用handsms的的弹出短信框会变得延时,chomp没自带短信甚至不能使用) &
15 Music.apk 自带音乐(可删,换成其他播放器) &
16 Provision.apk 开机引导程序 &&
17 SetupWizard.apk 开机引导(在定制rom时不可删,刷好机可用rootexplorer删掉,恢复出厂前要装回去) &&
18 SoundRecorder.apk 录音机(可用第三方录音软件替代) &&
19 Stk.apk sim卡服务(可删,有机油把联系人复制在sim卡上的就不要删它,删了可解决信号问题) &&
20 Superuser.apk 授权程序(就是程序列表上面那个,用这个获取root才有的) &
21 Term.apk 访问终端的 &&
22 VolumeControl.apk 音量控制中心 &
23 YGPS.apk 这个应该和GPS有关吧 &&
序号 可删除(58项) &&
1 Browser.apk 谷歌浏览器(喜欢UC的可用UC替代) &&
2 Calendar.apk 日历(不用日历的可删) &&
3 CalendarProvider.apk 日历程序支持服务(不用日历的可删) &
4 ChsPack.apk touchpal输入法拼音语言包(可删) &&
5 ChtPack.apk touchpal输入法注音语言包(从来不用注音的删)&
6 Email.apk Email(不用自带email接受邮件的可删) &
7 facebook.apk facebook(用不到的删) &&
8 GenieWidget.apk 天气与新闻(我自己不用他看新闻,删了) &
9 Gmail.apk Gmail邮件(可删) &&
10 GoogleBackupTransport.apk 谷歌备份(可删) &&
11 GoogleCalendarSyncAdapter.apk 谷歌日历同步适配器(可删) &
12 GoogleContactsSyncAdapter.apk 谷歌联系人同步适配器(可删) &
13 GoogleFeedback.apk 谷歌反馈(可删) &&
14 GooglePartnerSetup.apk Google合作伙伴设置(可删) &&
15 GoogleQuickSearchBox.apk 谷歌搜索(删了影响到桌面的搜索插件) &&
16 GoogleServicesFramework.apk 谷歌同步支持服务框架(删了不能同步联系人,不能登录google) &&
17 HTMLViewer.apk HTML浏览器(本地看html,用不到可删) &&
18 HWCalla_TaiWan.apk 繁体中文手写输入法(可写简体的,不用手写的可删) &
19 KaiXinAccountService.apk 未知程序,没敢删 &
20 LatinIME.apk android键盘输入法(可删) & &
21 LatinImeTutorial.apk android键盘输入法设置(可删) &&
22Launcher2.apk 2.2原生桌面(用ADW和PRO的可删,删了以后第三方桌面要在开机以后从电脑安装,91,豌豆助手都可)
23LiveWallpapers.apk 动态壁纸 &&
24 LiveWallpapersPicker.apk 同上动态壁纸(可删) &
25 LiveWalls.apk 动态壁纸(可删) & &
26 Maps.apk Google地图(可删,自行换成brust版本) &&
27 MarketUpdater.apk 谷歌市场升级(软件更新用到,可删) &
28MediaUploader.apk 媒体上传(可删) &
29 MMITest_II.apk 工程模式里用到的手机测试程序(可删) &
30 NetworkLocation.apk 网络位置(可删) &
31 NotePad.apk 记事本(可删) &&
34 OneTimeInitiaLizer.apk 首次启动时用来裝 Google Apps 的,可刪除 &&
32 PicoTts.apk 可删(文字语言转换的语音合成引擎,设置-语音输入与输出中) &
33 PingYinIME.apk 拼音输入法 &&
34 ProjectMenuAct.apk 工程菜单 &&
35Protips.apk 桌面小绿人插件(可删,就是有提示怎么玩手机) &
36RenRenAccountService.apk &&
37SNSCommon.apk 常见的SNS,不需要,删 &
38 SnsContentProvider.apk SnS的内容提供商,删 &
39 SnsWidget.apk SnS的小工具,删 &
40 SnsWidget24.apk SnS社区,删 &&
41 Soundback.apk 辅助功能 删 &&
42 Street.apk 谷歌街道(可删,对于国内街道无效果的貌似,与地图关联) &
43 Talk.apk 谷歌talk(可删,但删了就用不了电子市场) &
47 Talkback.apk 辅助功能 删 &&
44 TouchPal.apk TouchPal输入法(可删,但自带的三种输入法最好至少保留一种) &
45 TtsService.apk Google TTS(Text-to-speech)语音库服务(可删) &
46 TwidroydFree342-Huawei-rev1.apk twitter客户端(不用的删了) &
47 Updataonline.apk 在线升级(可删) &
48 UserDictionaryProvider.apk 用户数据字典服务(可删) &&
49 Vending.apk 电子市场(可删,不过不建议,很多软件的自动升级时候有它很方便) &
50 VisualizationWalls.apk 动态音乐背景壁纸 (删了) &&
51 VoiceSearch.apk 语音搜索(可删,虽然看上去很美好,事实上我从未用过) &
52 VpnServices.apk VPN服务(vpn服务,可删) &
53 YouTube.apk YouTube视频(要vpn才能看,删了) &
&三:换字体 &&
1、机器必须root过(因为要把三个TTF字体复制到系统里) &&
2、准备好你要刷的ttf字体和root浏览器(字体可以从电脑里取,也可以字体网站下载,英文字体一般不超1M,中文字体最好是不要超过8M,超过8M万一内存不足系统会出错的,切记!) &
3、把你想要更换的TTF字体改名(内容如下): &DroidSans.ttf 系统默认英文字体 & DroidSans-Bold.ttf 系统默认英文粗字体 &DroidSansFallback.ttf 系统默认中文字体 & 《注意:英文的大小写,包括ttf的大小写》 &
【来源:未知】查看: 2534|回复: 20
android 5.0中字库文件管理配置的变化
!curr_group! 大班 need_renew!curr_credits! 146, next_group
本帖最后由 华清论坛 于
08:22 编辑
android 5.0中字库文件管理配置的变化,主要需要来关注的地方是,与Typeface有关的一些变动。在android 5.0系统里面,新增加了一个名为fonts.xml的文件,来做系统字库文件的配置管理,这个文件在代码库中的位置为:frameworks/base/data/fonts/fonts.xml。我们可以来看一下这个新增文件的具体内容:
&?xml version=&1.0& encoding=&utf-8&?&
&!--
& & NOTE: this is the newer (L) version of the system font configuration,
& & supporting richer weight selection. Some apps will expect the older
& & version, so please keep system_fonts.xml and fallback_fonts.xml in sync
& & with any changes, even though framework will only read this file.
& & All fonts withohut names are added to the default list. Fonts are chosen
& & based on a match: full BCP-47 language tag including script, then just
& & language, and finally order (the first font containing the glyph).
& & Order of appearance is also the tiebreaker for weight matching. This is
& & the reason why the 900 weights of Roboto precede the 700 weights - we
& & prefer the former when an 800 weight is requested. Since bold spans
& & effectively add 300 to the weight, this ensures that 900 is the bold
& & paired with the 500 weight, ensuring adequate contrast.
--&
&familyset version=&22&&
& & &!-- first font is default --&
& & &family name=&sans-serif&&
& && &&&&font weight=&100& style=&normal&&Roboto-Thin.ttf&/font&
& && &&&&font weight=&100& style=&italic&&Roboto-ThinItalic.ttf&/font&
& && &&&&font weight=&300& style=&normal&&Roboto-Light.ttf&/font&
& && &&&&font weight=&300& style=&italic&&Roboto-LightItalic.ttf&/font&
& && &&&&font weight=&400& style=&normal&&Roboto-Regular.ttf&/font&
& && &&&&font weight=&400& style=&italic&&Roboto-Italic.ttf&/font&
& && &&&&font weight=&500& style=&normal&&Roboto-Medium.ttf&/font&
& && &&&&font weight=&500& style=&italic&&Roboto-MediumItalic.ttf&/font&
& && &&&&font weight=&900& style=&normal&&Roboto-Black.ttf&/font&
& && &&&&font weight=&900& style=&italic&&Roboto-BlackItalic.ttf&/font&
& && &&&&font weight=&700& style=&normal&&Roboto-Bold.ttf&/font&
& && &&&&font weight=&700& style=&italic&&Roboto-BoldItalic.ttf&/font&
& & &/family&
& & &!-- Note that aliases must come after the fonts they reference. --&
& & &alias name=&sans-serif-thin& to=&sans-serif& weight=&100& /&
& & &alias name=&sans-serif-light& to=&sans-serif& weight=&300& /&
& & &alias name=&sans-serif-medium& to=&sans-serif& weight=&500& /&
& & &alias name=&sans-serif-black& to=&sans-serif& weight=&900& /&
& & &alias name=&arial& to=&sans-serif& /&
& & &alias name=&helvetica& to=&sans-serif& /&
& & &alias name=&tahoma& to=&sans-serif& /&
& & &alias name=&verdana& to=&sans-serif& /&
& & &family name=&sans-serif-condensed&&
& && &&&&font weight=&300& style=&normal&&RobotoCondensed-Light.ttf&/font&
& && &&&&font weight=&300& style=&italic&&RobotoCondensed-LightItalic.ttf&/font&
& && &&&&font weight=&400& style=&normal&&RobotoCondensed-Regular.ttf&/font&
& && &&&&font weight=&400& style=&italic&&RobotoCondensed-Italic.ttf&/font&
& && &&&&font weight=&700& style=&normal&&RobotoCondensed-Bold.ttf&/font&
& && &&&&font weight=&700& style=&italic&&RobotoCondensed-BoldItalic.ttf&/font&
& & &/family&
& & &alias name=&sans-serif-condensed-light& to=&sans-serif-condensed& weight=&300& /&
& & &family name=&serif&&
& && &&&&font weight=&400& style=&normal&&NotoSerif-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSerif-Bold.ttf&/font&
& && &&&&font weight=&400& style=&italic&&NotoSerif-Italic.ttf&/font&
& && &&&&font weight=&700& style=&italic&&NotoSerif-BoldItalic.ttf&/font&
& & &/family&
& & &alias name=&times& to=&serif& /&
& & &alias name=&times new roman& to=&serif& /&
& & &alias name=&palatino& to=&serif& /&
& & &alias name=&georgia& to=&serif& /&
& & &alias name=&baskerville& to=&serif& /&
& & &alias name=&goudy& to=&serif& /&
& & &alias name=&fantasy& to=&serif& /&
& & &alias name=&ITC Stone Serif& to=&serif& /&
& & &family name=&monospace&&
& && &&&&font weight=&400& style=&normal&&DroidSansMono.ttf&/font&
& & &/family&
& & &alias name=&sans-serif-monospace& to=&monospace& /&
& & &alias name=&monaco& to=&monospace& /&
& & &family name=&serif-monospace&&
& && &&&&font weight=&400& style=&normal&&CutiveMono.ttf&/font&
& & &/family&
& & &alias name=&courier& to=&serif-monospace& /&
& & &alias name=&courier new& to=&serif-monospace& /&
& & &family name=&casual&&
& && &&&&font weight=&400& style=&normal&&ComingSoon.ttf&/font&
& & &/family&
& & &family name=&cursive&&
& && &&&&font weight=&400& style=&normal&&DancingScript-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&DancingScript-Bold.ttf&/font&
& & &/family&
& & &family name=&sans-serif-smallcaps&&
& && &&&&font weight=&400& style=&normal&&CarroisGothicSC-Regular.ttf&/font&
& & &/family&
& & &!-- fallback fonts --&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoNaskh-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoNaskh-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoNaskhUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoNaskhUI-Bold.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansEthiopic-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansEthiopic-Bold.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansHebrew-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansHebrew-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansThai-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansThai-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansThaiUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansThaiUI-Bold.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansArmenian-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansArmenian-Bold.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansGeorgian-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansGeorgian-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansDevanagari-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansDevanagari-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansDevanagariUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansDevanagariUI-Bold.ttf&/font&
& & &/family&
& & &!-- Gujarati should come after Devanagari --&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansGujarati-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansGujarati-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansGujaratiUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansGujaratiUI-Bold.ttf&/font&
& & &/family&
& & &!-- Gurmukhi should come after Devanagari --&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansGurmukhi-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansGurmukhi-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansGurmukhiUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansGurmukhiUI-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansTamil-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansTamil-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansTamilUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansTamilUI-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansMalayalam-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansMalayalam-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansMalayalamUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansMalayalamUI-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansBengali-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansBengali-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansBengaliUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansBengaliUI-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansTelugu-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansTelugu-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansTeluguUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansTeluguUI-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansKannada-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansKannada-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansKannadaUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansKannadaUI-Bold.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansSinhala-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansSinhala-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansKhmer-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansKhmer-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansKhmerUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansKhmerUI-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansLao-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansLao-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansLaoUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansLaoUI-Bold.ttf&/font&
& & &/family&
& & &family variant=&elegant&&
& && &&&&font weight=&400& style=&normal&&NotoSansMyanmar-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansMyanmar-Bold.ttf&/font&
& & &/family&
& & &family variant=&compact&&
& && &&&&font weight=&400& style=&normal&&NotoSansMyanmarUI-Regular.ttf&/font&
& && &&&&font weight=&700& style=&normal&&NotoSansMyanmarUI-Bold.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansCherokee-Regular.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansCanadianAboriginal-Regular.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansYi-Regular.ttf&/font&
& & &/family&
& & &family lang=&zh-Hans&&
& && &&&&font weight=&400& style=&normal&&NotoSansHans-Regular.otf&/font&
& & &/family&
& & &family lang=&zh-Hant&&
& && &&&&font weight=&400& style=&normal&&NotoSansHant-Regular.otf&/font&
& & &/family&
& & &family lang=&ja&&
& && &&&&font weight=&400& style=&normal&&NotoSansJP-Regular.otf&/font&
& & &/family&
& & &family lang=&ko&&
& && &&&&font weight=&400& style=&normal&&NotoSansKR-Regular.otf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NanumGothic.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoSansSymbols-Regular-Subsetted.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&NotoColorEmoji.ttf&/font&
& & &/family&
& & &family&
& && &&&&font weight=&400& style=&normal&&DroidSansFallback.ttf&/font&
& & &/family&
& & &family lang=&ja&&
& && &&&&font weight=&400& style=&normal&&MTLmr3m.ttf&/font&
& & &/family&
&/familyset&复制代码如同这个文件开头的註释中所描述的那样,暂时为了保持兼容性,仍然会保留老的字库配置文件system_fonts.xml和fallback_fonts.xml,并要求这个文件随时要与那两个文件同步。也就是说,这个文件中会包含那两个文件所包含的全部内容,并且这个文件还会提供更加丰富的功能。看到这里,我们难免会產生疑问,这个文件是在什麼地方加载解析的呢?而加载解析出来的信息又是如何被使用的呢?简单搜索,不难明白,这个文件正是在android.graphics.Typeface class初始化的时候进行加载的,其整个的过程如下:static Typeface[] sD
private static final LongSparseArray&SparseArray&Typeface&& sTypefaceCache =
& && &&&new LongSparseArray&SparseArray&Typeface&&(3);
static Typeface sDefaultT
static Map&String, Typeface& sSystemFontM
static FontFamily[] sFallbackF
static final String FONTS_CONFIG = &fonts.xml&;
private static void setDefault(Typeface t) {
& & sDefaultTypeface =
& & nativeSetDefault(t.native_instance);
}
* Create a new typeface from an array of font families.
* @param families array of font families
*/
public static Typeface createFromFamilies(FontFamily[] families) {
& & long[] ptrArray = new long[families.length];
& & for (int i = 0; i & families. i++) {
& && &&&ptrArray[i] = families[i].mNativeP
& & }
& & return new Typeface(nativeCreateFromArray(ptrArray));
}
* Create a new typeface from an array of font families, including
* also the font families in the fallback list.
* @param families array of font families
*/
public static Typeface createFromFamiliesWithDefault(FontFamily[] families) {
& & long[] ptrArray = new long[families.length + sFallbackFonts.length];
& & for (int i = 0; i & families. i++) {
& && &&&ptrArray[i] = families[i].mNativeP
& & }
& & for (int i = 0; i & sFallbackFonts. i++) {
& && &&&ptrArray[i + families.length] = sFallbackFonts[i].mNativeP
& & }
& & return new Typeface(nativeCreateFromArray(ptrArray));
}
// don't allow clients to call this directly
private Typeface(long ni) {
& & if (ni == 0) {
& && &&&throw new RuntimeException(&native typeface cannot be made&);
& & }
& & native_instance =
& & mStyle = nativeGetStyle(ni);
}
private static FontFamily makeFamilyFromParsed(FontListParser.Family family) {
& & FontFamily fontFamily = new FontFamily(family.lang, family.variant);
& & for (FontListParser.Font font : family.fonts) {
& && &&&fontFamily.addFontWeightStyle(font.fontName, font.weight, font.isItalic);
& & }
& & return fontF
}
* (non-Javadoc)
* This should only be called once, from the static class initializer block.
*/
private static void init() {
& & // Load font config and initialize Minikin state
& & File systemFontConfigLocation = getSystemFontConfigLocation();
& & File configFilename = new File(systemFontConfigLocation, FONTS_CONFIG);
& & try {
& && &&&FileInputStream fontsIn = new FileInputStream(configFilename);
& && &&&FontListParser.Config fontConfig = FontListParser.parse(fontsIn);
& && &&&List&FontFamily& familyList = new ArrayList&FontFamily&();
& && &&&// Note that the default typeface is always present
& && &&&// this is an enhancement from pre-Minikin behavior.
& && &&&for (int i = 0; i & fontConfig.families.size(); i++) {
& && && && &Family f = fontConfig.families.get(i);
& && && && &if (i == 0 || f.name == null) {
& && && && && & familyList.add(makeFamilyFromParsed(f));
& && && && &}
& && &&&}
& && &&&sFallbackFonts = familyList.toArray(new FontFamily[familyList.size()]);
& && &&&setDefault(Typeface.createFromFamilies(sFallbackFonts));
& && &&&Map&String, Typeface& systemFonts = new HashMap&String, Typeface&();
& && &&&for (int i = 0; i & fontConfig.families.size(); i++) {
& && && && &T
& && && && &Family f = fontConfig.families.get(i);
& && && && &if (f.name != null) {
& && && && && & if (i == 0) {
& && && && && && &&&// The first entry is
no sense in
& && && && && && &&&// duplicating the corresponding FontFamily.
& && && && && && &&&typeface = sDefaultT
& && && && && & } else {
& && && && && && &&&FontFamily fontFamily = makeFamilyFromParsed(f);
& && && && && && &&&FontFamily[] families = { fontFamily };
& && && && && && &&&typeface = Typeface.createFromFamiliesWithDefault(families);
& && && && && & }
& && && && && & systemFonts.put(f.name, typeface);
& && && && &}
& && &&&}
& && &&&for (FontListParser.Alias alias : fontConfig.aliases) {
& && && && &Typeface base = systemFonts.get(alias.toName);
& && && && &Typeface newFace =
& && && && &int weight = alias.
& && && && &if (weight != 400) {
& && && && && & newFace = new Typeface(nativeCreateWeightAlias(base.native_instance, weight));
& && && && &}
& && && && &systemFonts.put(alias.name, newFace);
& && &&&}
& && &&&sSystemFontMap = systemF
& & } catch (RuntimeException e) {
& && &&&Log.w(TAG, &Didn't create default family (most likely, non-Minikin build)&, e);
& && &&&// TODO: normal in non-Minikin case, remove or make error when Minikin-only
& & } catch (FileNotFoundException e) {
& && &&&Log.e(TAG, &Error opening & + configFilename);
& & } catch (IOException e) {
& && &&&Log.e(TAG, &Error reading & + configFilename);
& & } catch (XmlPullParserException e) {
& && &&&Log.e(TAG, &XML parse exception for & + configFilename);
& & }
}
static {
& & init();
& & // Set up defaults and typefaces exposed in public API
& & DEFAULT& && && &= create((String) null, 0);
& & DEFAULT_BOLD& & = create((String) null, Typeface.BOLD);
& & SANS_SERIF& && &= create(&sans-serif&, 0);
& & SERIF& && && &&&= create(&serif&, 0);
& & MONOSPACE& && & = create(&monospace&, 0);
& & sDefaults = new Typeface[] {
& && &&&DEFAULT,
& && &&&DEFAULT_BOLD,
& && &&&create((String) null, Typeface.ITALIC),
& && &&&create((String) null, Typeface.BOLD_ITALIC),
& & };
private static File getSystemFontConfigLocation() {
& & return new File(&/system/etc/&);
}
private static native long nativeCreateFromTypeface(long native_instance, int style);
private static native long nativeCreateWeightAlias(long native_instance, int weight);
复制代码前面我们提到的那个fonts.xml文件,在编译的时候,会被放在system/etc/下,此处会加载那个文件。通过FontListParser.parse(fontsIn)将文件中的所有信息解析为一个FontListParser.Config结构。此处我们还是先来看一下,相关的这样一些结构(android.graphics.FontListParser):public class FontListParser {
& & public static class Config {
& && &&&Config() {
& && && && &families = new ArrayList&Family&();
& && && && &aliases = new ArrayList&Alias&();
& && &&&}
& && &&&public List&Family&
& && &&&public List&Alias&
& & }
& & public static class Font {
& && &&&Font(String fontName, int weight, boolean isItalic) {
& && && && &this.fontName = fontN
& && && && &this.weight =
& && && && &this.isItalic = isI
& && &&&}
& && &&&public String fontN
& && &&&
& && &&&public boolean isI
& & }
& & public static class Alias {
& && &&&public S
& && &&&public String toN
& && &&&
& & }
& & public static class Family {
& && &&&public Family(String name, List&Font& fonts, String lang, String variant) {
& && && && &this.name =
& && && && &this.fonts =
& && && && &this.lang =
& && && && &this.variant =
& && &&&}
& && &&&public S
& && &&&public List&Font&
& && &&&public S
& && &&&public S
& & }复制代码用一张图来简单描述上面各个结构之间的关系:
FontListParser.Config中包含一个FontListParser.Family的列表和一个FontListParser.Alias的列表。FontListParser.Alias描述了一个FontListParser.Family的别名,它会帮忙建立别名到FontListParser.Family的映射关系。一个FontListParser.Family则可能有一个或多个FontListParser.Font组成。每个FontListParser.Font描述了一个字库文件,会包含有字库文件的路径、语言、variant等信息。可以认为FontListParser.Config就是fonts.xml文件中根元素familyset的映射,FontListParser.Family就是fonts.xml文件中一个family元素的映射,FontListParser.Alias是一个alias元素的映射,而FontListParser.Font则是一个font元素的映射。我们简单地扫一眼FontListParser中解析整个文件的过程,唯一值得注意的地方就是FontListParser.Font的fontName。解析之后,这个字段中保存的不再仅仅是一个字库文件的文件名,而是字库文件的完整的路径名,系统的字库文件存放路径均为/system/fonts/。至于其他方面,则这些结构就都是文件内容的比较直接的映射了。了解了这些相关的结构之后,我们继续来看前面Typeface.init()对于FontListParser.Config中保存的解析出来的数据的处理。在解析出了FontListParser.Config之后,它首先会创建fallback font family的列表。它会为每个fallback font的FontListParser.Family创建一个FontFamily结构,并将这所有的这些fallback font的FontFamily保存在一个数组sFallbackFonts中。Family list中的第一个family或者没有family name的font family会被认为是fallback font family。紧接着它就会创建default 的typeface。然后它会创建一个system font family的typeface列表。首先呢,它会为每一个system类型,即family name不会空的FontListParser.Family创建typeface。紧接着,它会为所有的FontListParser.Alias创建system font family的typeface。以个人的理解,android 5.0中,Java framework层似乎是在此处用sDefaultTypeface和sSystemFontMap将系统中所有的字库文件的typeface都给串起来了。整个的结构大体如下图这样:
这个过程似乎还有一个谜没有解开,那就是nativeCreateFromArray(),拿到了一堆的native层FontFamily结构的指针去创建native的typeface,它究竟都干了什么事情呢?接着我们就来看一下,在frameworks/base/core/jni/android/graphics/Typeface.cpp文件中这个方法的实现:static jlong Typeface_createFromArray(JNIEnv *env, jobject, jlongArray familyArray) {
& & ScopedLongArrayRO families(env, familyArray);
& & return reinterpret_cast&jlong&(TypefaceImpl_createFromFamilies(families.get(), families.size()));
}复制代码进一步是TypefaceImpl_createFromFamilies(),在frameworks/base/core/jni/android/graphics/TypefaceImpl.cpp中:
TypefaceImpl* TypefaceImpl_createFromFamilies(const jlong* families, size_t size) {
& & std::vector&FontFamily *&familyV
& & for (size_t i = 0; i & i++) {
& && &&&FontFamily* family = reinterpret_cast&FontFamily*&(families[i]);
& && &&&familyVec.push_back(family);
& & }
& & TypefaceImpl* result = new TypefaceI
& & result-&fFontCollection = new FontCollection(familyVec);
& & if (size == 0) {
& && &&&ALOGW(&createFromFamilies creating empty collection&);
& && &&&result-&fSkiaStyle = SkTypeface::kN
& & } else {
& && &&&const FontStyle defaultS
& && &&&FontFamily* firstFamily = reinterpret_cast&FontFamily*&(families[0]);
& && &&&MinikinFont* mf = firstFamily-&getClosestMatch(defaultStyle).
& && &&&if (mf != NULL) {
& && && && &SkTypeface* skTypeface = reinterpret_cast&MinikinFontSkia*&(mf)-&GetSkTypeface();
& && && && &// TODO: probably better to query more precise style from family, will be important
& && && && &// when we open up API to access 100..900 weights
& && && && &result-&fSkiaStyle = skTypeface-&style();
& && &&&} else {
& && && && &result-&fSkiaStyle = SkTypeface::kN
& && &&&}
& & }
& & result-&fBaseWeight = 400;
& & resolveStyle(result);
& &
}复制代码可以看到,在此处,创建一个TypefaceImpl,然后这个结构会指向一个FontCollection,而在后者中,将保存传入的所有的字库文件的Typeface的引用。那创建的这些结构究竟都有些什么用呢?可以看一些android.graphics.Typeface中的其他方法:/**
* Create a typeface object given a family name, and option style information.
* If null is passed for the name, then the &default& font will be chosen.
* The resulting typeface object can be queried (getStyle()) to discover what
* its &real& style characteristics are.
* @param familyName May be null. The name of the font family.
* @param style&&The style (normal, bold, italic) of the typeface.
*& && && && && &e.g. NORMAL, BOLD, ITALIC, BOLD_ITALIC
* @return The best matching typeface.
*/
public static Typeface create(String familyName, int style) {
& & if (sSystemFontMap != null) {
& && &&&return create(sSystemFontMap.get(familyName), style);
& & }
& &
}
* Create a new typeface from the specified font data.
* @param mgr The application's asset manager
* @param path&&The file name of the font data in the assets directory
* @return The new typeface.
*/
public static Typeface createFromAsset(AssetManager mgr, String path) {
& & if (sFallbackFonts != null) {
& && &&&FontFamily fontFamily = new FontFamily();
& && &&&if (fontFamily.addFontFromAsset(mgr, path)) {
& && && && &FontFamily[] families = { fontFamily };
& && && && &return createFromFamiliesWithDefault(families);
& && &&&}
& & }
& & throw new RuntimeException(&Font asset not found & + path);
}
* Create a new typeface from the specified font file.
* @param path The full path to the font data.
* @return The new typeface.
*/
public static Typeface createFromFile(String path) {
& & if (sFallbackFonts != null) {
& && &&&FontFamily fontFamily = new FontFamily();
& && &&&if (fontFamily.addFont(path)) {
& && && && &FontFamily[] families = { fontFamily };
& && && && &return createFromFamiliesWithDefault(families);
& && &&&}
& & }
& & throw new RuntimeException(&Font not found & + path);
}复制代码指定字库文件创建Typeface时就总是会用到fallback fonts的信息,而不指定字库文件创建Typeface时,则总是会用到system fonts的有关信息。Done。
——————————————————————————————————————不拼爹,靠技术打天下,走起!——————————————————————————————————————
上一篇:下一篇:
copy_link&copy_link_words
享有帖子相关版权3、其他单位或个人使用、转载或引用本文时必须同时征得该帖子作者和的同意4、帖子作者须承担一切因本文发表而直接或间接导致的民事或刑事法律责任5、本帖部分内容转载自其它媒体,但并不代表本站赞同其观点和对其真实性负责6、如本帖侵犯到任何版权问题,请立即告知本站,本站将及时予与删除并致以最深的歉意7、管理员和版主有权不事先通知发贴者而删除本文', this.href);">copyright
!curr_group! 高中!curr_credits! 5624, next_group
!curr_group! 初中!curr_credits! 2882, next_group
不管你信不信,反正我是信了。
!curr_group! 高中!curr_credits! 5624, next_group
啥也不说了,楼主就是给力!
!curr_group! 初中!curr_credits! 2878, next_group
专业始于专注 卓识源于远见
!curr_group! 初中!curr_credits! 2893, next_group
!curr_group! 初中!curr_credits! 2899, next_group
!curr_group! 初中!curr_credits! 2844, next_group
不管你信不信,反正我是信了。
!curr_group! 初中!curr_credits! 2861, next_group
啥也不说了,楼主就是给力!
!curr_group! 初中!curr_credits! 2857, next_group
你的情操再怎么高尚,我也不会赞美;
小华妹荐 /3
不同层次的电子书都有,欢迎大家下载阅读。
适用于初学者 以及 工作1-2年的人,菜鸟自学Unity 3D,入门必备6部电子图书。
涉及Linux编程及网络安全电子书,有初级也有高级,适用人群广泛!
Powered by}

我要回帖

更多关于 ttf2fnt字库转换软件 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信