博主介绍:本人专注于Android/java/数据库/微信小程序技术领域的开发,以及有好几年的计算机毕业设计方面的实战开发经验和技术积累;尤其是在安卓(Android)的app的开发和微信小程序的开发,很是熟悉和了解;本人也是多年的Android开发人员;希望我发布的此篇文件可以帮助到您;
🍅希望此文章可以帮助到您🍅
微信小程序文章推荐
微信小程序布局图片上面显示文字
微信小程序实现左边图片右边文字效果
微信小程序获取当前日期和时间
微信小程序绘制地图轨迹线路
微信小程序绘制marker
微信小程序之绘制多个marker以及调用手机地图软件导航
方法一:本地字体
1:前端界面
<view style="padding: 50rpx;">
<view style="text-align: center;padding: 50rpx;font-size: 35rpx;font-weight: bold;">字体设置</view>
<view class="oneFont">
1:我是第一种字体
</view>
<view style="font-size: 30rpx;margin-top: 20rpx;">
说明:直接使用(font-family: 楷体)进行字体设置
</view>
</view>
2:css样式
.oneFont{
font-family: 楷体;
font-weight: bold;
color: #f00;
}
说明:字体的字体样式设计
方法二:第三方字体
说明:假如你需要使用系统以外的字体的话,那么就需要如下操作;
1:前端代码
<view class="twoFont" style="margin-top: 50rpx;">
2:我是第二种字体
</view>
<view style="font-size: 30rpx;margin-top: 20rpx;">
说明:引用第三方字体进行字体设置
</view>
2:wxss设置字体文件
@font-face {
font-family: 'PangMenZhengDao';
src: url('data:font/ttf;charset=utf-8;base64,AAEAAAAPAIAAAwBwR0RFRgASAAwAABR0AAAAFk9TLzJbf/E1AAAKdAAAAGBjbWFwDBG7yAAACtQAAABsY3Z0IAAZACgAABEMAAAACGZwZ23RhEEzAAALQAAABbtnYXNwAB8ACQAAFGQAAAAQZ2x5ZpuHXTUAAAD8AAAIvGhlYWQL1NsHAAAJ9AAAADZoaGVhB9YDcQAAClAAAAAkaG10eAziAGYAAAosAAAAJGxvY2EIYgXdAAAJ2AAAABptYXhwAmYFUAAACbgAAAAgbmFtZX9TRFUAABEUAAAC1HBvc3RTPTq8AAAT6AAAAHxwcmVw4AA8rAAAEPwAAAAQAAIALAAvA2wCogADAAcAF7gAHisAugAHA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MAAQAAABQABABYAAAAEgAQAAMAAgAgToxPU1tXYhF2hHnNeyz//wAAACBOjE9TW1diEXaEec17LP///+SxebCzpLCd94mFhj2E3wABAAAAAAAAAAAAAAAAAAAAAAAAuAAALEu4AAxQWLEBAY5ZuAH/hbgARB25AAwAA19eLbgAASwgIEVpRLABYC24AAIsuAABKiEtuAADLCBGsAMlRlJYI1kgiiCKSWSKIEYgaGFksAQlRiBoYWRSWCNlilkvILAAU1hpILAAVFghsEBZG2kgsABUWCGwQGVZWTotuAAELCBGsAQlRlJYI4pZIEYgamFksAQlRiBqYWRSWCOKWS/9LbgABSxLILADJlBYUViwgEQbsEBEWRshISBFsMBQWLDARBshWVktuAAGLCAgRWlEsAFgICBFfWkYRLABYC24AAcsuAAGKi24AAgsSyCwAyZTWLCAG7BAWYqKILADJlNYIyGwwIqKG4ojWSCwAyZTWCMhuAEAioobiiNZILADJlNYIyG4AUCKihuKI1kguAADJlNYsAMlRbgBgFBYIyG4AYAjIRuwAyVFIyEjIVkbIVlELbgACSxLU1hFRBshIVktuAAKLEu4AAhQWLEBAY5ZuAH/hbgARB25AAgAA19eLbgACywgIEVpRLABYC24AAwsuAALKiEtuAANLCBGsAMlRlJYI1kgiiCKSWSKIEYgaGFksAQlRiBoYWRSWCNlilkvILAAU1hpILAAVFghsEBZG2kgsABUWCGwQGVZWTotuAAOLCBGsAQlRlJYI4pZIEYgamFksAQlRiBqYWRSWCOKWS/9LbgADyxLILADJlBYUViwgEQbsEBEWRshISBFsMBQWLDARBshWVktuAAQLCAgRWlEsAFgICBFfWkYRLABYC24ABEsuAAQKi24ABIsSyCwAyZTWLBAG7AAWYqKILADJlNYIyGwgIqKG4ojWSCwAyZTWCMhuADAioobiiNZILADJlNYIyG4AQCKihuKI1kgsAMmU1gjIbgBQIqKG4ojWSC4AAMmU1iwAyVFuAGAUFgjIbgBgCMhG7ADJUUjISMhWRshWUQtuAATLEtTWEVEGyEhWS24ABQsS7gACFBYsQEBjlm4Af+FuABEHbkAC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QABAAAAAAAHAC0AQwADAAEECQAAAEIAcAADAAEECQABAB4AsgADAAEECQACAA4A0AADAAEECQADAB4AsgADAAEECQAEAB4AsgADAAEECQAFABgA3gADAAEECQAGAB4AsgADAAEECQAHAFoA9gADAAEIBAAAAEIAcAADAAEIBAABAA4BUAADAAEIBAACAA4A0AADAAEIBAADAA4BUAADAAEIBAAEAA4BUAADAAEIBAAFABgA3gADAAEIBAAHAFwBXihjKSBQYW5nTWVuWmhlbmdEYW8gSHVYaWFvQm8gMjAxNlBhbmdNZW5aaGVuZ0Rhb1JlZ3VsYXJWZXJzaW9uIDMuMTJUcmFkZW1hcmsgb2YgWkhPTkdRSSBFbGVjdHJvbmljIENvLiwgU2hhbmdIYWkAKABjACkAIABQAGEAbgBnAE0AZQBuAFoAaABlAG4AZwBEAGEAbwAgAEgAdQBYAGkAYQBvAEIAbwAgADIAMAAxADYAUABhAG4AZwBNAGUAbgBaAGgAZQBuAGcARABhAG8AUgBlAGcAdQBsAGEAcgBWAGUAcgBzAGkAbwBuACAAMwAuADEAMgBUAHIAYQBkAGUAbQBhAHIAawAgAG8AZgAgAFoASABPAE4ARwBRAEkAIABFAGwAZQBjAHQAcgBvAG4AaQBjACAAQwBvAC4ALAAgAFMAaABhAG4AZwBIAGEAaV6elehrY5BTaAeYmE9TAFQAcgBhAGQAZQBtAGEAcgBrACAAbwBmACAASABVAFgASQBBAE8AQgBPACAARQBsAGUAYwB0AHIAbwBuAGkAYwAgAEMAbwAuACwAIABTAGgAYQBuAGcASABhAGkAAgAAAAAAAP99AC4AAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAQACAQIAAwEDAQQBBQEGAQcBCAEJCWdseXBoNDY3MAd1bmk0RThDB3VuaTRGNTMHdW5pNUI1Nwd1bmk2MjExB3VuaTc2ODQHdW5pNzlDRAd1bmk3QjJDAAAAAwAIAAIAGAAB//8AAwABAAAADAAAAAAAAAACAAEAAgALAAEAAA==') format('truetype');
font-weight: normal;
font-style: normal;
font-display: swap;
}.twoFont{
font-family: PangMenZhengDao;
font-weight: bold;
color: #f00;
}
说明:使用第三方字体步骤
1:下载需要的字体
2:需要访问Online @font-face generator — Transfonter网站添加字体文件以及导出,操作流程如下:
3:导入下载的文件到wxss里面,也就是
然后在“font-family: PangMenZhengDao;”里面进行设置就可以了;
3:注意点
因为微信小程序的代码上传的时候文件大小不能超过2M;所以直接拿一个字体库放在项目里面是不可以的;因此假如需要第三方字体的话;需要根据如上的操作,吧需要的字体抽取出来;然后在前端界面进行显示的预览;
留个脚印吧
大家要是感觉此篇文章有意义;那就给个关注、点赞,收藏吧;文章来源:https://www.toymoban.com/news/detail-757603.html
🍅也可以关注文档末尾公众号🍅文章来源地址https://www.toymoban.com/news/detail-757603.html
到了这里,关于微信小程序自定义字体样式、字体修改、第三方字体设置的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!