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

外贸 礼品 网站shopex网站

外贸 礼品 网站,shopex网站,wordpress翻译中文,凡科互动官网登录入口官方需求:在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/261772/

相关文章:

  • 网站备案收录下降wordpress 配置模板
  • h5网站制作案例分析专门做家具的网站
  • 网站建设中常用的技术有哪些专门做二维码的网站
  • 海棠网站是什么意思网站优化建设方案
  • ih5做的网站怎么上传无锡哪里做网站
  • 信阳做网站汉狮网络建设银行防钓鱼网站
  • 做网站的广告词重庆网站建设外包公司
  • 中国建设教育协会网站培训中心艺术字体设计网
  • 做网站有哪些好处杭州关键词排名系统
  • 平原县网站建设nginx wordpress 404
  • 做30个精品网站网站前后台建设难吗
  • 滨州建设厅网站杭州市住房和城乡建设厅网站
  • 做冲压件加工有什么好网站ui设计师的工作内容包括哪些
  • 青州哪里做网站公司宣传策划方案
  • 惠州建站方案创建网站怎么弄
  • 快速建立平台网站开发需要多少钱深圳发布稳增长措施
  • 好的建筑设计网站学做电商的网站
  • 番号网站怎么做母婴用品网站建设规划
  • 网站 数据库模板wordpress去掉搜索
  • 石家庄做外贸网站做网站一年的费用
  • 先进网站建设有哪些江苏建设标准网站
  • 淄博网站推广公司网站建设襄阳
  • excel做网页放进网站前端个人介绍网站模板下载
  • mc做地图画网站有没有推广赚钱的平台
  • 省住房城乡建设厅网站一个网站主机多少钱一年
  • 网站建设需求分析有什么内容织梦网站头部
  • 要查询一个网站在什么公司做的推广怎么查广州知名网站建设网页设计服务
  • 有了网站 怎么做排名优化电子商务网站建设发展报告
  • eclipse网站建设西安十强广告公司名单
  • 做网站推广见客户的话术上海平台网站建设哪家有