当前位置: 首页 > news >正文

山西山西省建设厅网站首页国内网站主机

山西山西省建设厅网站首页,国内网站主机,秦皇岛黄金海岸收费吗,华建集团上海建筑设计研究院需求:在11.0 12.0系统定制化开发中,在产品定制中,有产品需求对于系统字体风格不太满意,所以想要更换系统的默认字体,对于系统字体的修改也是常有的功能,而系统默认也支持增加字体,所以就来添加楷…

需求:在11.0 12.0系统定制化开发中,在产品定制中,有产品需求对于系统字体风格不太满意,所以想要更换系统的默认字体,对于系统字体的修改也是常有的功能,而系统默认也支持增加字体,所以就来添加楷体字体为系统字体,并替换为系统默认字体。

  1. 添加系统字体并且设置为默认字体的核心类

frameworks/base/data/fonts/
frameworks/base/data/fonts/fonts.mk
frameworks/base/data/fonts/Android.mk
frameworks/base/data/fonts/fonts.xml 
  1. 添加系统字体并且设置为默认字体核心功能实现和分析

对于系统添加新字体功能,是默认支持的但是有些字体会导致系统的支持性不是太好,所以要选择好系统字体也是比较关键的

具体步骤如下:

2.1fonts下增加新字体

在目录frameworks/base/data/fonts/ 添加 KTFont.ttf

2.2 在frameworks/base/data/fonts/fonts.mk中添加新的字体

具体先看fonts.mk文件

# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License.# Warning: this is actually a product definition, to be inherited fromPRODUCT_PACKAGES := \DroidSansMono.ttf \AndroidClock.ttf \fonts.xml

增加新字体如下:

PRODUCT_PACKAGES := \DroidSansMono.ttf \AndroidClock.ttf \
+    KTFont.ttf \fonts.xml

2.3 在frameworks/base/data/fonts/Android.mk中添加新的字体

在font_src_files 添加新增的字体格式,如下

 ################################# Build the rest of font files as prebuilt.# $(1): The source file name in LOCAL_PATH.#       It also serves as the module name and the dest file name.define build-one-font-module$(eval include $(CLEAR_VARS))\$(eval LOCAL_MODULE := $(1))\$(eval LOCAL_SRC_FILES := $(1))\$(eval LOCAL_MODULE_CLASS := ETC)\$(eval LOCAL_MODULE_TAGS := optional)\$(eval LOCAL_MODULE_PATH := $(TARGET_OUT)/fonts)\$(eval include $(BUILD_PREBUILT))endef
font_src_files := \AndroidClock.ttf \KTFont.ttf

2.4fonts.xml配置默认字体作为默认系统字体

frameworks/base/data/fonts/fonts.xml 中替换默认字体

先来看下 fonts.xml

<?xml version="1.0" encoding="utf-8"?>
<!--WARNING: Parsing of this file by third-party apps is not supported. Thefile, and the font files it refers to, will be renamed and/or moved outfrom their respective location in the next Android release, and/or theformat or syntax of the file may change significantly. If you parse thisfile for information about system fonts, do it at your own risk. Yourapplication will almost certainly break with the next major Androidrelease.In this file, all fonts without names are added to the default list.Fonts are chosen based on a match: full BCP-47 language tag includingscript, then just language, and finally order (the first font containingthe glyph).Order of appearance is also the tiebreaker for weight matching. This isthe reason why the 900 weights of Roboto precede the 700 weights - weprefer the former when an 800 weight is requested. Since bold spanseffectively add 300 to the weight, this ensures that 900 is the boldpaired with the 500 weight, ensuring adequate contrast.
-->
<familyset version="23"><!-- 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="500" style="normal">RobotoCondensed-Medium.ttf</font><font weight="500" style="italic">RobotoCondensed-MediumItalic.ttf</font><font weight="700" style="normal">RobotoCondensed-Bold.ttf</font><font weight="700" style="italic">RobotoCondensed-BoldItalic.ttf</font></family>。。。。。

通过阅读代码发现第一个family 就是默认的字体KTFont.ttf 所以要把添加在一条就行了

所以修改如下:

 <familyset version="23"><!-- first font is default --><family name="sans-serif">
+           <font weight="400" style="normal">KTFont.ttf</font><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="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>
@@ -545,10 +546,7 @@<family>

同时注意要注释掉相同属性的 Roboto-Regular.ttf的字体 不然系统会抛异常开不了机

在加载系统默认字体的时候 weight 400的字体已经存在了 所以要注释掉一个即可

http://www.yayakq.cn/news/715385/

相关文章:

  • 外贸公司网站搭建建设部网站质量终身责任承诺书
  • 安卓网站客户端制作软件烟台北京网站建设
  • php网站后台反应慢怎么解决商丘有哪些网络公司
  • 免费网站下载直播软件大全网站建设名词解释
  • 供别人采集的网站怎么做谁会在掏宝网上做网站
  • a做爰网站网站开发培训价格
  • 定制型网站一般价格wordpress导航类主题
  • 谁有手机网站发几个吧国际新闻最新消息今天新闻大事件 中方
  • 网站定制开发是什么意思网站服务器建设合同范本
  • 做网站一般多钱网店代运营收费标准
  • 上海做网站培训班临汾做网站公司哪家好
  • 禹州 什么团购网站做的好免费咨询更多详情
  • 做购物网站适合的服务器电子商务有限公司简介
  • 河南网站建设品牌如何提高景区旅游网站建设
  • wordpress建两个网站开发公司成本费用表格
  • 医疗网站建设管理怎么登录百度app
  • 男男做视频网站单位网站建设情况
  • c 开发手机网站开发公司建设网站请示
  • seo比较好的优化方法东莞网站排名优化报价
  • 绵阳市住房 和城乡建设局网站asp网站木马扫描
  • 备案的网站做跳转不影响备案把wordpress 手风琴
  • 南昌网站建设公司咨询wordpress 数据库 开发
  • 网页制作网站图片狂人站群系统
  • 泉州专业网站制作定制市场营销的十大理论
  • 东莞哪里做网站搜题在线使用网页版
  • 网站域名解析登陆网站怎么制作
  • 网站后台首页模板给几个网站谢谢
  • 商务网站建设与维护流程网站建设页面页脚怎么设置
  • 视频网站如何做营销策划中国自适应网站建设
  • 域名和网站关联百度人工投诉电话是多少