- ソース を表示
- Starling+Feathersで縦書き へ行く。
| 1: 2015-05-21 (木) 13:34:36 njf |
現: 2015-05-22 (金) 01:24:43 njf |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | test | + | ActionScriptで縦書きする場合、CPUレンダリングではTextBlockクラスで可能です。 |
| + | |||
| + | FeathersではTextBlockTextRendererクラスでTextBlockをGPUレンダリングしてくれるのですが、2015年5月現在、まだ縦書きには対応していないようです。 | ||
| + | |||
| + | しかし、Feathersのソースコードを一部変更すれば簡単に縦書き表示が可能となります。 | ||
| + | |||
| + | 大きく分けて3カ所修正が必要です。TextRotation.ROTATE_90が指定されているときは | ||
| + | |||
| + | -行の幅を高さに修正 | ||
| + | -行のx座標を少し左に(そのままでは描画領域からはみ出すので) | ||
| + | -中心寄せ、右寄せ、左寄せの計算をxからy、widthからheightに変更 | ||
| + | |||
| + | です。 | ||
| + | |||
| + | Feathers ver 2.1.1でその変更を行ったTextBlockTextRenderer.asは以下の添付ファイルで | ||
| + | |||
| + | 使うときは以下のような感じで。 | ||
| + | |||
| + | var textRenderer:TextBlockTextRenderer = new TextBlockTextRenderer(); | ||
| + | var fontDescription:FontDescription = new FontDescription( MY_MAIN_FONT_NAME, FontWeight.NORMAL, | ||
| + | FontPosture.NORMAL, FontLookup.EMBEDDED_CFF, RenderingMode.CFF, CFFHinting.NONE ); | ||
| + | var ef:ElementFormat = new ElementFormat( fontDescription,fontSize, color ); | ||
| + | ef.locale = "ja"; | ||
| + | textRenderer.elementFormat = ef; | ||
| + | textRenderer.width = width; | ||
| + | textRenderer.height = height; | ||
| + | textRenderer.wordWrap = true; | ||
| + | textRenderer.lineRotation = TextRotation.ROTATE_90; | ||
| + | textRenderer.text = "いろはにほへと ちりぬるを"; | ||
| + | addChild(textRenderer); | ||
- Starling+Feathersで縦書き のバックアップ一覧
- Starling+Feathersで縦書き のバックアップ差分(No. All)
- 1: 2015-05-21 (木) 13:34:36 njf
- 現: 2015-05-22 (金) 01:24:43 njf
| ぺージ情報 | |
|---|---|
| ぺージ名 : | Starling+Feathersで縦書き |
| ページ別名 : | 未設定 |
| ページ作成 : | njf |
| 閲覧可 | |
| グループ : | すべての訪問者 |
| ユーザー : | すべての訪問者 |
| 編集可 | |
| グループ : | すべての訪問者 |
| ユーザー : | すべての訪問者 |
Counter: 2427,
today: 2,
yesterday: 2

