Egret之位图字体

1 , 关于位图字体的制作
Egret之位图字体

2 , egret官方提供的资源
Egret之位图字体

看看cartoon-font.fnt的内容

{"file":"cartoon-font.png","frames":{
"A":{"x":1,"y":54,"w":21,"h":24,"offX":2,"offY":11,"sourceW":23,"sourceH":35},
"B":{"x":195,"y":29,"w":22,"h":26,"offX":2,"offY":10,"sourceW":24,"sourceH":36},
"C":{"x":31,"y":33,"w":20,"h":26,"offX":2,"offY":10,"sourceW":22,"sourceH":36},
"D":{"x":171,"y":1,"w":24,"h":26,"offX":2,"offY":10,"sourceW":26,"sourceH":36},
"E":{"x":108,"y":55,"w":19,"h":24,"offX":2,"offY":11,"sourceW":21,"sourceH":35},
"F":{"x":167,"y":80,"w":18,"h":24,"offX":2,"offY":11,"sourceW":20,"sourceH":35},
"G":{"x":197,"y":1,"w":23,"h":26,"offX":2,"offY":10,"sourceW":25,"sourceH":36},
"H":{"x":143,"y":1,"w":26,"h":24,"offX":2,"offY":11,"sourceW":28,"sourceH":35},
"I":{"x":235,"y":141,"w":13,"h":24,"offX":2,"offY":11,"sourceW":15,"sourceH":35},
"J":{"x":205,"y":107,"w":15,"h":25,"offX":2,"offY":11,"sourceW":17,"sourceH":36},
"K":{"x":117,"y":1,"w":24,"h":26,"offX":2,"offY":10,"sourceW":26,"sourceH":36},
"L":{"x":147,"y":55,"w":18,"h":24,"offX":2,"offY":11,"sourceW":20,"sourceH":35},
"M":{"x":1,"y":27,"w":28,"h":25,"offX":2,"offY":11,"sourceW":30,"sourceH":36},
"N":{"x":193,"y":57,"w":22,"h":24,"offX":2,"offY":11,"sourceW":24,"sourceH":35},
"O":{"x":91,"y":1,"w":24,"h":26,"offX":2,"offY":10,"sourceW":26,"sourceH":36},
"P":{"x":219,"y":54,"w":22,"h":25,"offX":2,"offY":10,"sourceW":24,"sourceH":35},
"Q":{"x":37,"y":1,"w":24,"h":30,"offX":2,"offY":10,"sourceW":26,"sourceH":40},
"R":{"x":143,"y":27,"w":23,"h":26,"offX":2,"offY":10,"sourceW":25,"sourceH":36},
"S":{"x":128,"y":107,"w":16,"h":26,"offX":3,"offY":10,"sourceW":19,"sourceH":36},
"T":{"x":86,"y":29,"w":21,"h":24,"offX":2,"offY":11,"sourceW":23,"sourceH":35},
"U":{"x":222,"y":27,"w":23,"h":25,"offX":2,"offY":11,"sourceW":25,"sourceH":36},
"V":{"x":217,"y":81,"w":22,"h":24,"offX":2,"offY":11,"sourceW":24,"sourceH":35},
"W":{"x":1,"y":1,"w":34,"h":24,"offX":2,"offY":11,"sourceW":36,"sourceH":35},
"X":{"x":222,"y":1,"w":24,"h":24,"offX":2,"offY":11,"sourceW":26,"sourceH":35},
"Y":{"x":168,"y":54,"w":23,"h":24,"offX":2,"offY":11,"sourceW":25,"sourceH":35},
"Z":{"x":109,"y":29,"w":21,"h":24,"offX":2,"offY":11,"sourceW":23,"sourceH":35},
"0":{"x":86,"y":55,"w":20,"h":25,"offX":2,"offY":10,"sourceW":22,"sourceH":35},
"1":{"x":235,"y":114,"w":13,"h":25,"offX":2,"offY":10,"sourceW":15,"sourceH":35},
"2":{"x":146,"y":140,"w":16,"h":24,"offX":2,"offY":11,"sourceW":18,"sourceH":35},
"3":{"x":146,"y":113,"w":16,"h":25,"offX":3,"offY":10,"sourceW":19,"sourceH":35},
"4":{"x":1,"y":80,"w":19,"h":24,"offX":2,"offY":11,"sourceW":21,"sourceH":35},
"5":{"x":164,"y":132,"w":17,"h":24,"offX":2,"offY":11,"sourceW":19,"sourceH":35},
"6":{"x":108,"y":81,"w":18,"h":25,"offX":2,"offY":10,"sourceW":20,"sourceH":35},
"7":{"x":164,"y":106,"w":17,"h":24,"offX":3,"offY":11,"sourceW":20,"sourceH":35},
"8":{"x":24,"y":61,"w":19,"h":25,"offX":2,"offY":10,"sourceW":21,"sourceH":35},
"9":{"x":53,"y":56,"w":19,"h":26,"offX":2,"offY":10,"sourceW":21,"sourceH":36},
"a":{"x":1,"y":54,"w":21,"h":24,"offX":2,"offY":11,"sourceW":23,"sourceH":35},
"b":{"x":195,"y":29,"w":22,"h":26,"offX":2,"offY":10,"sourceW":24,"sourceH":36},
"c":{"x":31,"y":33,"w":20,"h":26,"offX":2,"offY":10,"sourceW":22,"sourceH":36},
"d":{"x":171,"y":1,"w":24,"h":26,"offX":2,"offY":10,"sourceW":26,"sourceH":36},
"e":{"x":108,"y":55,"w":19,"h":24,"offX":2,"offY":11,"sourceW":21,"sourceH":35},
"f":{"x":167,"y":80,"w":18,"h":24,"offX":2,"offY":11,"sourceW":20,"sourceH":35},
"g":{"x":197,"y":1,"w":23,"h":26,"offX":2,"offY":10,"sourceW":25,"sourceH":36},
"h":{"x":143,"y":1,"w":26,"h":24,"offX":2,"offY":11,"sourceW":28,"sourceH":35},
"i":{"x":235,"y":141,"w":13,"h":24,"offX":2,"offY":11,"sourceW":15,"sourceH":35},
"j":{"x":205,"y":107,"w":15,"h":25,"offX":2,"offY":11,"sourceW":17,"sourceH":36},
"k":{"x":117,"y":1,"w":24,"h":26,"offX":2,"offY":10,"sourceW":26,"sourceH":36},
"l":{"x":147,"y":55,"w":18,"h":24,"offX":2,"offY":11,"sourceW":20,"sourceH":35},
"m":{"x":1,"y":27,"w":28,"h":25,"offX":2,"offY":11,"sourceW":30,"sourceH":36},
"n":{"x":193,"y":57,"w":22,"h":24,"offX":2,"offY":11,"sourceW":24,"sourceH":35},
"o":{"x":91,"y":1,"w":24,"h":26,"offX":2,"offY":10,"sourceW":26,"sourceH":36},
"p":{"x":219,"y":54,"w":22,"h":25,"offX":2,"offY":10,"sourceW":24,"sourceH":35},
"q":{"x":37,"y":1,"w":24,"h":30,"offX":2,"offY":10,"sourceW":26,"sourceH":40},
"r":{"x":143,"y":27,"w":23,"h":26,"offX":2,"offY":10,"sourceW":25,"sourceH":36},
"s":{"x":128,"y":107,"w":16,"h":26,"offX":3,"offY":10,"sourceW":19,"sourceH":36},
"t":{"x":86,"y":29,"w":21,"h":24,"offX":2,"offY":11,"sourceW":23,"sourceH":35},
"u":{"x":222,"y":27,"w":23,"h":25,"offX":2,"offY":11,"sourceW":25,"sourceH":36},
"v":{"x":217,"y":81,"w":22,"h":24,"offX":2,"offY":11,"sourceW":24,"sourceH":35},
"w":{"x":1,"y":1,"w":34,"h":24,"offX":2,"offY":11,"sourceW":36,"sourceH":35},
"x":{"x":222,"y":1,"w":24,"h":24,"offX":2,"offY":11,"sourceW":26,"sourceH":35},
"y":{"x":168,"y":54,"w":23,"h":24,"offX":2,"offY":11,"sourceW":25,"sourceH":35},
"z":{"x":109,"y":29,"w":21,"h":24,"offX":2,"offY":11,"sourceW":23,"sourceH":35},
",":{"x":247,"y":34,"w":8,"h":11,"offX":3,"offY":29,"sourceW":11,"sourceH":40},
".":{"x":213,"y":157,"w":9,"h":6,"offX":3,"offY":30,"sourceW":12,"sourceH":36},
"~":{"x":213,"y":151,"w":18,"h":4,"offX":4,"offY":21,"sourceW":22,"sourceH":25},
"\"":{"x":183,"y":155,"w":10,"h":11,"offX":4,"offY":11,"sourceW":14,"sourceH":22},
"!":{"x":243,"y":54,"w":11,"h":25,"offX":4,"offY":11,"sourceW":15,"sourceH":36},
"|":{"x":248,"y":1,"w":7,"h":31,"offX":3,"offY":8,"sourceW":10,"sourceH":39},
"\\":{"x":147,"y":83,"w":15,"h":28,"offX":2,"offY":9,"sourceW":17,"sourceH":37},
";":{"x":132,"y":29,"w":9,"h":21,"offX":4,"offY":19,"sourceW":13,"sourceH":40},
":":{"x":205,"y":83,"w":9,"h":17,"offX":4,"offY":19,"sourceW":13,"sourceH":36},
"<":{"x":200,"y":134,"w":12,"h":12,"offX":3,"offY":17,"sourceW":15,"sourceH":29},
">":{"x":183,"y":141,"w":12,"h":12,"offX":3,"offY":17,"sourceW":15,"sourceH":29},
"?":{"x":187,"y":83,"w":16,"h":26,"offX":3,"offY":10,"sourceW":19,"sourceH":36},
"+":{"x":183,"y":127,"w":15,"h":12,"offX":4,"offY":18,"sourceW":19,"sourceH":30},
"_":{"x":164,"y":158,"w":17,"h":3,"offX":2,"offY":37,"sourceW":19,"sourceH":40},
"=":{"x":197,"y":148,"w":14,"h":9,"offX":4,"offY":19,"sourceW":18,"sourceH":28},
"-":{"x":164,"y":163,"w":11,"h":5,"offX":4,"offY":25,"sourceW":15,"sourceH":30},
")":{"x":222,"y":107,"w":11,"h":31,"offX":4,"offY":7,"sourceW":15,"sourceH":38},
"#":{"x":128,"y":85,"w":17,"h":20,"offX":3,"offY":13,"sourceW":20,"sourceH":33},
"$":{"x":129,"y":55,"w":16,"h":28,"offX":2,"offY":9,"sourceW":18,"sourceH":37},
"%":{"x":63,"y":1,"w":26,"h":26,"offX":2,"offY":10,"sourceW":28,"sourceH":36},
"^":{"x":214,"y":140,"w":15,"h":9,"offX":5,"offY":18,"sourceW":20,"sourceH":27},
"&":{"x":63,"y":29,"w":21,"h":25,"offX":2,"offY":11,"sourceW":23,"sourceH":36},
"*":{"x":183,"y":111,"w":14,"h":14,"offX":3,"offY":11,"sourceW":17,"sourceH":25},
"(":{"x":241,"y":81,"w":12,"h":31,"offX":3,"offY":7,"sourceW":15,"sourceH":38},
"@":{"x":168,"y":29,"w":25,"h":23,"offX":2,"offY":12,"sourceW":27,"sourceH":35},
"'":{"x":53,"y":33,"w":5,"h":11,"offX":4,"offY":11,"sourceW":9,"sourceH":22}}}

实际上是Json文件 , 文本对应的是Json的Key

3 , 资源加载
Egret之位图字体

4 , 核心代码

module demo{/*** 测试位图字体* @author Husz*/export class BitMapTextView extends egret.DisplayObjectContainer{private _bitmapText : egret.BitmapText = null;private _bitmapFont : egret.BitmapFont = null;public constructor(){super();this._bitmapText = new egret.BitmapText();this._bitmapFont = RES.getRes("cartoon-font_fnt");this._bitmapText.font = this._bitmapFont;this._bitmapText.x = this._bitmapText.y = 150;this.addChild( this._bitmapText ); }/*** 显示文本*/public showText( $str : string ) : void{this._bitmapText.text = $str;}}
}

调用:

            let $demo : BitMapTextView = new BitMapTextView();this.addChild($demo);$demo.showText("I am Aonaufly!");

结果:
Egret之位图字体

官方:

/*** 以下示例演示了使用 BitmapText 显示特殊字体。*/
class BitmapFontExample extends egret.DisplayObjectContainer {public constructor() {super();RES.getResByUrl("resource/assets/font.fnt", this.onLoadComplete, this,RES.ResourceItem.TYPE_FONT);}private onLoadComplete(font:egret.BitmapFont):void {var bitmapText:egret.BitmapText = new egret.BitmapText();bitmapText.font = font;this.addChild(bitmapText);bitmapText.text = "Hello Egret";}
}

转载于:https://blog.51cto.com/aonaufly/2067382

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/255549.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

图像处理基本算法-滤波

线性滤波器的向量表示&#xff1a; W是一个大小为m*n的滤波器的系数&#xff0c;Z为由滤波器覆盖的相应图像的灰度值。 线性滤波器所能是实现的就是乘积求和操作。 几种常见的滤波器&#xff1a; 平滑空间滤波器如均值滤波 统计排序滤波器如中值滤波 锐化空间滤波器如锐化…

20145122《Java面向对象程序设计》实验二实验报告

实验名称&#xff1a; Java面向对象程序设计 实验内容&#xff1a; 初步掌握单元测试和TDD理解并掌握面向对象三要素&#xff1a;封装、继承、多态初步掌握UML建模熟悉S.O.L.I.D原则了解设计模式 PSP时间 步骤耗时百分比需求分析1h12.5%设计1h12.5%代码实现3h37.5%测试1h12.5%分…

iOS中AutoLayer自动布局流程及相关方法

关于UIView的Layer&#xff0c;IOS提供了三个方法&#xff1a; 1、layoutSubviews 系统重写布局:在iOS5.1和之前的版本&#xff0c;此方法的缺省实现不会做任何事情(实现为空)&#xff0c;iOS5.1之后(iOS6开始)的版本&#xff0c;此方法的缺省实现是使用你设置在此view上面的co…

均值滤波 中值滤波 高斯平滑滤波

均值滤波是典型的线性滤波算法&#xff0c;它是指在图像上对目标像素给一个模板&#xff0c;该模板包括了其周围的临近像素&#xff08;以目标象素为中心的周围8个像素&#xff0c;构成一个滤波模板&#xff0c;即去掉目标像素本身&#xff09;&#xff0c;再用模板中的全体像素…

linux 安装RedisLive

为什么80%的码农都做不了架构师&#xff1f;>>> RedisLive 用来监控Redis&#xff0c;便于redis性能分析 安装步骤&#xff1a; 1.安装pip&#xff08;代码参考&#xff1a;https://github.com/pypa/pip&#xff09; 官方网站&#xff1a;https://pypi.python.org/…

高斯滤波和双向滤波的区别与联系

1. 简介 图像平滑是一个重要的操作&#xff0c;而且有多种成熟的算法。这里主要简单介绍一下Bilateral方法&#xff08;双边滤波&#xff09;&#xff0c;这主要是由于前段时间做了SSAO&#xff0c;需要用bilateral blur 算法进行降噪。Bilateral blur相对于传统的高斯blur来说…

Eclipse变量名自动补全问题 自定义上屏按键为TAB

Eclipse空格等号等都可以上屏&#xff0c;这样有时候输入变量名再按空格就会自动补全&#xff0c;非常讨厌。那么怎么办呢&#xff1f; 1.首先你的Eclipse需要装有 Eclipse plug-in development environment 和 Eclipse JDT Plug-in Developer Resources 或者直接去下载一个和…

Dreamweaver CS6 Mac破解版

介于之前小子分享的Mac版的Adobe的PS CS6和Illustrator CS6&#xff0c;有用户要求小子分享下Dreamweaver&#xff0c;小子当然乐意效劳。 Dreamweaver CS6 是世界顶级软件厂商Adobe推出的一套拥有可视化编辑界面&#xff0c;用于制作并编辑网站和移动应用程序的网页设计软件。…

【pyqt5学习】——graphicView显示matplotlib图像

目录 一、导入模块 二、自定义一个matplotlib窗口类Figure 三、利用QT_designer绘制窗口 四、写逻辑代码 五、结果展示 一、导入模块 import matplotlibmatplotlib.use("Qt5Agg") from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg from matplo…

what is ssao

说到ssao 就要从ao说起&#xff0c;ao&#xff0c;即间接环境光遮蔽技术。我们知道现实中的光线&#xff0c;除了来自太阳和电灯的直射光线以外&#xff0c;光线碰到物体以后&#xff0c;还会再次反射&#xff0c;折射&#xff0c;而再次反射折射的过程中&#xff0c;又会被其他…

【pyqt5学习】——groupBox显示matplotlib图像

目录 一、导入模块 二、创建matplotlib窗口类 三、qt_designer设计窗口 四、逻辑代码 五、结果展示 一、导入模块 import matplotlibmatplotlib.use("Qt5Agg") from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg from matplotlib.figure impor…

杭电1027Ignatius and the Princess II模拟

地址&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid1027 题目&#xff1a; Problem DescriptionNow our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill our pretty Princess. But now the BEelzebub has t…

angular 使用rxjs 监听同级兄弟组件数据变化

angular 的官网给出了父子组件之间数据交互的方法&#xff0c;如ViewChild、EventEmitter 但是如果要在同级组件之间进行数据同步&#xff0c;似乎并没有给出太多的信息。 有时候我们想&#xff0c;在一个组件中修改数据之后&#xff0c;马上反映到另外一个组件中&#xff0c; …

pic

转载于:https://www.cnblogs.com/edisonxiang/p/5392651.html

OpenCV之cvSmooth函数平滑滤波

1、cvSmooth函数用法 定义原型 <span style"font-size:12px;"> void cvSmooth( const CvArr* src, CvArr* dst,int smoothtypeCV_GAUSSIAN,int param1, int param2, double param3, double param4 );</span>src:输入图像. dst:输出图像. smoot…

【python数字信号处理】——DFT、DTFT(频谱图、幅度图、相位图)

目录 一、离散时间傅里叶变换DTFT 二、离散傅里叶变换DFT 三、DFT与DTFT的关系 ​ 参考&#xff1a; 《数字信号处理》——&#xff08;一&#xff09;.DTFT、DFT(python实现)_远行者223的博客-CSDN博客python绘制频谱图DTFT&#xff0c;DFTpython绘制频谱图&#xff1a;…

ERROR:Tried to register widget id ==basemapGalleryDiv but that id is already registered解决办法

在ArcGIS Server开发中&#xff0c;遇到DIV已经被注册的情况&#xff0c;不能对原DIV内容进行更新。这里需要调用Dojo的destroyRecursive&#xff08;&#xff09;方法&#xff0c;逐个销毁该Widget下的子元素及其后代元素。然后就可以在原DIV上注册新的小部件。 示例代码&…

图像金字塔

图像金字塔被广泛用于各种视觉应用中。图像金字塔是一个图像集合&#xff0c;集合中所有的图像都源于同一个原始图像&#xff0c;而且是通过对原始图像连续降采样活得&#xff0c;直到达到某个中止条件才停止降采样。&#xff08;当然&#xff0c;降为一个像素肯定是中止条件。…

【python数字信号处理】——Z变换

目录 一、公式 二、代码 三、结果 一、公式 频域变量&#xff1a;z 时域变量&#xff1a;n 常见序列的Z变换&#xff1a;信号与系统复习归纳&#xff08;十一&#xff09;&#xff1a;Z变换例题_百把人的博客-CSDN博客_z变换例题基于东南大学陈从颜译《信号、系统和变换》和…

九宫格拼图 支持44 55等

代码下载转载于:https://www.cnblogs.com/ygcool/p/5395343.html