顯示具有 Feathers 標籤的文章。 顯示所有文章
顯示具有 Feathers 標籤的文章。 顯示所有文章

2013-07-08

Feathers ui 使用裝置字型

之前提到 Feathers components 的字型 的問題,用了一陣子之後發現她內部提供的 embeded 字型好用,但只有英文字型。

其文件中載明最好使用 bitmap fonts;在效能上 bitmap fonts 最好,embeded fonts 次之,device fonts 最差(呈現出來的效果也最差)。但許多時候,難免會用到英文以外的字型,用 device fonts 是最好的解法。

在 iPhone 上由於 retina resolution 的關係,device font 沒有反鋸齒,效果也不會太差。但 Feathers ui 並沒有一個設定可以由預設的 embeded fonts 直接改用 device fonts。我自己的做法是複製 MetalWorksMobileTheme.as 另存成 MetalWorksMobileThemeDeviceFont.as,直接修改 MetalWorksMobileThemeDeviceFont 類別的內容。

把 regularFontNames 改成我要的 device fonts
const regularFontNames:String = "Heiti TC Light,Heiti SC Light,微軟正黑體,_sans";

接著把所有的
.embedFonts = true;
改成
.embedFonts = false;

字型呈現在 iPhone 上算 OK,但感覺是有點暴力的解法 :P

2013-06-01

Feathers components 的字型

Feathers :UI components for Starling Framework
看它的 Demo 感覺滿不錯的,但試玩就處處碰壁。

首先,themes 並不包含在 feathers.swc 裡,必須另外設定 themes 的路徑。themes 和 demo 的原始碼都有包含在下載包裡。

第二,使用某個 theme 時 ( 相信你大概只會想使用 MetalWorksMobileTheme ),在 PC 上測試由於 DeviceCapabilities.dpi 只有 72,字會變得很小,可以改成 326 ( http://forum.starling-framework.org/topic/xscreendpi-and-web-applications-without-air )。

第三,使用某個 theme 之後,components 的字型、大小是不能在建立 components 後更改的,而必須使用繼承的方式設定 ( http://wiki.starling-framework.org/feathers/extending-themes )。

FB 留言