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.pswp.cn/news/255549.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/255549.shtml
英文地址,請注明出處:http://en.pswp.cn/news/255549.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【機器視覺】——平面測量實際尺寸(像素尺寸轉物理尺寸)

目錄 方法一:比例尺法 方法:二:三角法 方法三:相機標定 以下方法均在平面的前提下進行 方法一:比例尺法 在一張紙上繪制一個帶刻度的直線,將紙張放在攝像頭下,抓取任意兩點的像素坐標,計算像素距離pd,再根據刻度讀取實際距離ad,根據兩者可以求出縮放比例,即地圖上…

圖像處理基本算法-濾波

線性濾波器的向量表示&#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…

移動開發web第一天

一、適配問題解決方案&#xff1a;流式布局 viewport1、流式布局百分比布局&#xff0c;通過設置盒子的寬度為百分比來根據屏幕的大小進行伸縮&#xff0c;特點是不受固定像素的限制&#xff0c;內容向兩側填充2、viewport在移動端用來承載網頁的這個區域&#xff0c;就是我們…

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

均值濾波是典型的線性濾波算法&#xff0c;它是指在圖像上對目標像素給一個模板&#xff0c;該模板包括了其周圍的臨近像素&#xff08;以目標象素為中心的周圍8個像素&#xff0c;構成一個濾波模板&#xff0c;即去掉目標像素本身&#xff09;&#xff0c;再用模板中的全體像素…

javaWeb開發總結 ---- 前端數據插入到后臺

一&#xff0c;概述&#xff1a; 本文主要描述如何將數據通過表單提交到后臺并插入到數據庫&#xff0e;其中后臺使用spring框架&#xff0e; 二&#xff0c;開發流程&#xff1a; 明確需求&#xff0c;即將什么數據插入到數據庫平臺搭建&#xff0c;配置spring, 數據庫&#…

對clear float 的理解

之前自己對于清除浮動的用法比較模糊 &#xff0c;如果用到的話&#xff0c;一般都是采用簡單粗暴的方式解決&#xff0c;就是直接用overflow&#xff1a;hidden&#xff0c;但是越用久就會發現其實有BUG&#xff0c;這個BUG正是overflow&#xff1a;hidden帶來的&#xff0c;因…

【機器視覺】——相機標定降低重投影誤差方法

目錄 一、標定結果分析 二、影響標定誤差的原因 1、平面標定板黑白棋盤格的精度

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…

happens-before規則

1&#xff09;程序順序規則&#xff1a;一個線程中的每個操作&#xff0c;happens-before于該線程中的任意后續操作。2&#xff09;監視器鎖規則&#xff1a;對一個鎖的解鎖&#xff0c;happens-before于隨后對這個鎖的加鎖。3&#xff09;volatile變量規則&#xff1a;對一個v…

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…

[BZOJ3545][ONTAK2010]Peaks

[BZOJ3545][ONTAK2010]Peaks 試題描述 在Bytemountains有N座山峰&#xff0c;每座山峰有他的高度h_i。有些山峰之間有雙向道路相連&#xff0c;共M條路徑&#xff0c;每條路徑有一個困難值&#xff0c;這個值越大表示越難走&#xff0c;現在有Q組詢問&#xff0c;每組詢問詢問從…

杭電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…